v0.1 public beta early access on GitHub
Home / Screens / productivity-time-blocks
Screen template

Time Blocks

Time-blocking day view: category-colored blocks that check off, focus progress, Today/Tomorrow switch

pro Expo Go ✓ iosandroid gestures: tap · scroll haptics: selection
$ npx lumioui add productivity-time-blocks
import { TimeBlocksScreen } from "@/screens/productivity/time-blocks";
Registry dependencies4
Native packages installed6
@lumioui/ui@latest@lumioui/core@latestreact-native-safe-area-context@*react-native-reanimated@*react-native-svg@*nativewind@*
productivity/time-blocks.tsxsource · yours to edit
import * as React from "react";
import { useState } from "react";
import { ScrollView, View } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import { Chip, Icon, Progress, Text } from "@lumioui/ui";
import { cn, useHaptic } from "@lumioui/core";
import { Mount, Press, World } from "../shared";

interface Block {
  id: string;
  title: string;
  start: string;
  end: string;
  /** Block hue — time-blocking category color, a data color not a token. */
  color: string;
}

const DAYS: Record<string, Block[]> = {
  today: [
    { id: "t1", title: "Deep work — onboarding motion", start: "9:00", end: "10:30", color: "#818CF8" },
    { id: "t2", title: "Design review", start: "10:30", end: "11:00", color: "#FBBF24" },
    { id: "t3", title: "Inbox + replies", start: "11:00", end: "11:30", color: "#94A3B8" },
    { id: "t4", title: "Lunch", start: "12:30", end: "13:30", color: "#4ADE80" },
    { id: "t5", title: "Deep work — catalog audit", start: "13:30", end: "15:30", color: "#818CF8" },
    { id: "t6", title: "1:1 with Maya", start: "16:00", end: "16:30", color: "#FBBF24" },
    { id: "t7", title: "Plan tomorrow", start: "17:00", end: "17:30", color: "#94A3B8" },
  ],
  tomorrow: [
    { id: "w1", title: "Deep work — registry pipeline", start: "9:00", end: "11:00", color: "#818CF8" },
    { id: "w2", title: "Sprint planning", start: "11:00", end: "12:00", color: "#FBBF24" },
    { id: "w3", title: "Gym", start: "12:30", end: "13:30", color: "#4ADE80" },
    { id: "w4", title: "Deep work — screens pass", start: "14:00", end: "16:00", color: "#818CF8" },
    { id: "w5", title: "Coffee with Priya", start: "16:30", end: "17:00", color: "#4ADE80" },
  ],
};

export interface TimeBlocksScreenProps {
  days?: Record<string, Block[]>;
  onToggleBlock?: (id: string, done: boolean) => void;
  onBack?: () => void;
}

/** Time-blocking day view — Structured/Sunsama idiom: a day timeline of
 *  category-colored blocks that check off on tap, with a focus progress
 *  header and a Today/Tomorrow switch. */
export function TimeBlocksScreen({
  days = DAYS,
  onToggleBlock,
  onBack,
}: TimeBlocksScreenProps) {
  const haptics = useHaptic();
  const keys = Object.keys(days);
  const [day, setDay] = useState(keys[0] ?? "today");
  const [done, setDone] = useState<Set<string>>(new Set(["t2"]));

  const blocks = days[day] ?? [];
  const doneCount = blocks.filter((b) => done.has(b.id)).length;
  const pct = blocks.length ? Math.round((doneCount / blocks.length) * 100) : 0;

  const toggle = (id: string) => {
    haptics.selection();
    setDone((d) => {
      const next = new Set(d);
      if (next.has(id)) next.delete(id);
      else next.add(id);
      onToggleBlock?.(id, next.has(id));
      return next;
    });
  };

  return (
    <World primary="#65A30D">
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top", "bottom"]}>
      <View className="flex-row items-center justify-between px-6 pb-2 pt-3">
        <Press
          onPress={onBack}
          hitSlop={12}
          accessibilityRole="button"
          accessibilityLabel="Back"
          className="h-10 w-10 items-center justify-center rounded-full bg-muted"
        >
          <Icon name="chevron-left" size="md" color="foreground" />
        </Press>
        <Mount className="items-end">
          <Text variant="h3">Wednesday</Text>
          <Text variant="muted">Sep 23</Text>
        </Mount>
      </View>

      <View className="px-6 pb-4 pt-2">
        <Mount delay={60} className="flex-row items-end justify-between pb-2">
          <Text variant="muted">
            {doneCount} of {blocks.length} blocks done
          </Text>
          {/* Focus-time total — blockers track deep hours, not ticks. */}
          <View className="items-end">
            <Text variant="muted">{pct}%</Text>
            <Text variant="muted" className="text-[10px]">
              4h 10m focused
            </Text>
          </View>
        </Mount>
        <Progress value={pct} className="h-1.5" />
      </View>

      <View className="flex-row gap-2 px-6 pb-4">
        {keys.map((k) => (
          <Chip
            key={k}
            variant="filter"
            selected={day === k}
            onSelectedChange={() => setDay(k)}
            className="px-4 py-2"
          >
            {k === "today" ? "Today" : "Tomorrow"}
          </Chip>
        ))}
      </View>

      <ScrollView
        className="flex-1"
        contentContainerClassName="gap-3 px-6 pb-8"
        showsVerticalScrollIndicator={false}
      >
        {blocks.map((b) => {
          const isDone = done.has(b.id);
          return (
            <Press
              key={b.id}
              pressedScale={0.97}
              onPress={() => toggle(b.id)}
              accessibilityRole="button"
              accessibilityState={{ selected: isDone }}
              accessibilityLabel={`${b.title}, ${b.start} to ${b.end}`}
              className={cn(
                "flex-row overflow-hidden rounded-2xl bg-card",
                isDone && "opacity-60"
              )}
            >
              <View className="w-1.5" style={{ backgroundColor: b.color }} />
              <View className="w-14 items-center justify-center py-4">
                <Text variant="muted">{b.start}</Text>
              </View>
              <View className="flex-1 justify-center gap-0.5 py-4">
                <Text
                  variant="large"
                  className={cn(isDone && "text-muted-foreground line-through")}
                >
                  {b.title}
                </Text>
                <Text variant="muted">
                  {b.start} – {b.end}
                </Text>
              </View>
              <View className="items-center justify-center pr-4">
                <View
                  className={cn(
                    "h-6 w-6 items-center justify-center rounded-full border-2",
                    isDone ? "border-transparent" : "border-border"
                  )}
                  style={isDone ? { backgroundColor: b.color } : undefined}
                >
                  {isDone ? <Icon name="check" size="sm" color="#FFFFFF" /> : null}
                </View>
              </View>
            </Press>
          );
        })}
      </ScrollView>
    </SafeAreaView>
    </World>
  );
}
TimeBlocksScreen.displayName = "TimeBlocksScreen";
agent prompt — paste into Claude Code, Cursor, Devin…
Recreate the "Time Blocks" screen in React Native using LumioUI.

Goal: Time-blocking day view: category-colored blocks that check off, focus progress, Today/Tomorrow switch Match the reference implementation's layout, behavior, and motion exactly — this is a production screen, not a mockup.

## Setup

Fastest path — install the screen plus its component deps:

```bash
npx lumioui add productivity-time-blocks
```

Or pull just the components: `npx lumioui add chip icon progress text`

Native packages:
- @lumioui/ui@latest
- @lumioui/core@latest
- react-native-safe-area-context@*
- react-native-reanimated@*
- react-native-svg@*
- nativewind@*

Stack assumptions: Expo SDK 54 / RN 0.81, Reanimated 4, NativeWind v4, TypeScript strict, Expo Go compatible.

## Components — how, where, when

### `chip` — Compact selectable pill with press scale and ink overlay.
- `<Chip>` ×1

### `icon` — Lucide icon set mapped to theme colors and sizes.
- `<Icon>` ×2

### `progress` — Animated fill bar with indeterminate sweep mode.
- `<Progress>` ×1

### `text` — Themed type scale from caption to display.
- `<Text>` ×8

## Conventions (non-negotiable)

- Styling via NativeWind `className` with semantic tokens only: `bg-background`, `text-foreground`, `bg-card`, `text-card-foreground`, `bg-secondary`, `bg-muted`, `text-muted-foreground`, `bg-accent`, `bg-destructive`, `border-border`. Hard-coded colors only inside media overlays (`text-white`, `bg-black/N`).
- Motion via the token presets from `@lumioui/core` (`spring.press`, `spring.surface`, `spring.glide`, `timing.fast`, `timing.slow`, …) — no bespoke spring configs or durations.
- Gate transform motion behind `useReducedMotion()`; keep opacity/color feedback, drop travel and overshoot.
- Haptics via `useHaptic()`: `light` on press, `selection` on toggle/select, `warning` on invalid input. Never import expo-haptics directly.
- Press feedback via `usePressAnimation()` (~0.97 scale), not `activeOpacity` tricks.
- a11y: `accessibilityRole` + `accessibilityLabel` on every control, touch targets ≥44pt.
- Entrance choreography: staggered `Mount` wrappers (delay 0/60/120…) so regions land in sequence instead of popping in at once.
- Wrap the screen in `SafeAreaView`; keep dark mode working via the semantic tokens.

## Deliverable

One file: `screens/productivity/time-blocks.tsx` exporting TimeBlocksScreen. Preserve the props interface — the host app wires the callbacks (navigation, submit handlers) through them.

## Reference implementation

The LumioUI source for this screen — reproduce it faithfully:

```tsx
import * as React from "react";
import { useState } from "react";
import { ScrollView, View } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import { Chip, Icon, Progress, Text } from "@lumioui/ui";
import { cn, useHaptic } from "@lumioui/core";
import { Mount, Press, World } from "../shared";

interface Block {
  id: string;
  title: string;
  start: string;
  end: string;
  /** Block hue — time-blocking category color, a data color not a token. */
  color: string;
}

const DAYS: Record<string, Block[]> = {
  today: [
    { id: "t1", title: "Deep work — onboarding motion", start: "9:00", end: "10:30", color: "#818CF8" },
    { id: "t2", title: "Design review", start: "10:30", end: "11:00", color: "#FBBF24" },
    { id: "t3", title: "Inbox + replies", start: "11:00", end: "11:30", color: "#94A3B8" },
    { id: "t4", title: "Lunch", start: "12:30", end: "13:30", color: "#4ADE80" },
    { id: "t5", title: "Deep work — catalog audit", start: "13:30", end: "15:30", color: "#818CF8" },
    { id: "t6", title: "1:1 with Maya", start: "16:00", end: "16:30", color: "#FBBF24" },
    { id: "t7", title: "Plan tomorrow", start: "17:00", end: "17:30", color: "#94A3B8" },
  ],
  tomorrow: [
    { id: "w1", title: "Deep work — registry pipeline", start: "9:00", end: "11:00", color: "#818CF8" },
    { id: "w2", title: "Sprint planning", start: "11:00", end: "12:00", color: "#FBBF24" },
    { id: "w3", title: "Gym", start: "12:30", end: "13:30", color: "#4ADE80" },
    { id: "w4", title: "Deep work — screens pass", start: "14:00", end: "16:00", color: "#818CF8" },
    { id: "w5", title: "Coffee with Priya", start: "16:30", end: "17:00", color: "#4ADE80" },
  ],
};

export interface TimeBlocksScreenProps {
  days?: Record<string, Block[]>;
  onToggleBlock?: (id: string, done: boolean) => void;
  onBack?: () => void;
}

/** Time-blocking day view — Structured/Sunsama idiom: a day timeline of
 *  category-colored blocks that check off on tap, with a focus progress
 *  header and a Today/Tomorrow switch. */
export function TimeBlocksScreen({
  days = DAYS,
  onToggleBlock,
  onBack,
}: TimeBlocksScreenProps) {
  const haptics = useHaptic();
  const keys = Object.keys(days);
  const [day, setDay] = useState(keys[0] ?? "today");
  const [done, setDone] = useState<Set<string>>(new Set(["t2"]));

  const blocks = days[day] ?? [];
  const doneCount = blocks.filter((b) => done.has(b.id)).length;
  const pct = blocks.length ? Math.round((doneCount / blocks.length) * 100) : 0;

  const toggle = (id: string) => {
    haptics.selection();
    setDone((d) => {
      const next = new Set(d);
      if (next.has(id)) next.delete(id);
      else next.add(id);
      onToggleBlock?.(id, next.has(id));
      return next;
    });
  };

  return (
    <World primary="#65A30D">
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top", "bottom"]}>
      <View className="flex-row items-center justify-between px-6 pb-2 pt-3">
        <Press
          onPress={onBack}
          hitSlop={12}
          accessibilityRole="button"
          accessibilityLabel="Back"
          className="h-10 w-10 items-center justify-center rounded-full bg-muted"
        >
          <Icon name="chevron-left" size="md" color="foreground" />
        </Press>
        <Mount className="items-end">
          <Text variant="h3">Wednesday</Text>
          <Text variant="muted">Sep 23</Text>
        </Mount>
      </View>

      <View className="px-6 pb-4 pt-2">
        <Mount delay={60} className="flex-row items-end justify-between pb-2">
          <Text variant="muted">
            {doneCount} of {blocks.length} blocks done
          </Text>
          {/* Focus-time total — blockers track deep hours, not ticks. */}
          <View className="items-end">
            <Text variant="muted">{pct}%</Text>
            <Text variant="muted" className="text-[10px]">
              4h 10m focused
            </Text>
          </View>
        </Mount>
        <Progress value={pct} className="h-1.5" />
      </View>

      <View className="flex-row gap-2 px-6 pb-4">
        {keys.map((k) => (
          <Chip
            key={k}
            variant="filter"
            selected={day === k}
            onSelectedChange={() => setDay(k)}
            className="px-4 py-2"
          >
            {k === "today" ? "Today" : "Tomorrow"}
          </Chip>
        ))}
      </View>

      <ScrollView
        className="flex-1"
        contentContainerClassName="gap-3 px-6 pb-8"
        showsVerticalScrollIndicator={false}
      >
        {blocks.map((b) => {
          const isDone = done.has(b.id);
          return (
            <Press
              key={b.id}
              pressedScale={0.97}
              onPress={() => toggle(b.id)}
              accessibilityRole="button"
              accessibilityState={{ selected: isDone }}
              accessibilityLabel={`${b.title}, ${b.start} to ${b.end}`}
              className={cn(
                "flex-row overflow-hidden rounded-2xl bg-card",
                isDone && "opacity-60"
              )}
            >
              <View className="w-1.5" style={{ backgroundColor: b.color }} />
              <View className="w-14 items-center justify-center py-4">
                <Text variant="muted">{b.start}</Text>
              </View>
              <View className="flex-1 justify-center gap-0.5 py-4">
                <Text
                  variant="large"
                  className={cn(isDone && "text-muted-foreground line-through")}
                >
                  {b.title}
                </Text>
                <Text variant="muted">
                  {b.start} – {b.end}
                </Text>
              </View>
              <View className="items-center justify-center pr-4">
                <View
                  className={cn(
                    "h-6 w-6 items-center justify-center rounded-full border-2",
                    isDone ? "border-transparent" : "border-border"
                  )}
                  style={isDone ? { backgroundColor: b.color } : undefined}
                >
                  {isDone ? <Icon name="check" size="sm" color="#FFFFFF" /> : null}
                </View>
              </View>
            </Press>
          );
        })}
      </ScrollView>
    </SafeAreaView>
    </World>
  );
}
TimeBlocksScreen.displayName = "TimeBlocksScreen";
```

Screen: https://lumioui.dev/screens/productivity-time-blocks
iPhone 17 · iOS
9:41
Live preview — the real screen via Expo Web · open full ↗