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

Calendar Day Screen

Hour timeline with events

pro Expo Go ✓ iosandroid gestures: tap · scroll haptics: light · selection
$ npx lumioui add productivity-calendar-day
import { CalendarDayScreen } from "@/screens/productivity/calendar-day";
Registry dependencies3
Native packages installed6
@lumioui/ui@latestreact-native-safe-area-context@*@lumioui/core@latestreact-native-reanimated@*react-native-svg@*nativewind@*
productivity/calendar-day.tsxsource · yours to edit
import * as React from "react";
import { ScrollView, View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Button, Icon, Text } from "@lumioui/ui";
import { Mount, Press, World } from "../shared";

export interface DayEvent {
  id: string;
  start: string;
  end: string;
  title: string;
  place: string;
  color: string;
}

export interface CalendarDayScreenProps {
  day?: string;
  events?: DayEvent[];
  onEventPress?: (id: string) => void;
  onBack?: () => void;
}

const DEFAULT_EVENTS: DayEvent[] = [
  { id: "e0", start: "8:00", end: "8:45", title: "Morning run", place: "Embarcadero", color: "bg-success" },
  { id: "e1", start: "9:00", end: "9:45", title: "Standup", place: "Zoom", color: "bg-[#65A30D]" },
  { id: "e2", start: "10:00", end: "10:45", title: "Design review", place: "Studio", color: "bg-warning" },
  { id: "e5", start: "11:00", end: "12:00", title: "Deep work — motion spec", place: "Focus", color: "bg-secondary-foreground" },
  { id: "e3", start: "12:30", end: "1:15", title: "Lunch with Sam", place: "Café Cielo", color: "bg-success" },
  { id: "e6", start: "2:00", end: "2:30", title: "1:1 with Maya", place: "Studio", color: "bg-warning" },
  { id: "e4", start: "3:00", end: "4:00", title: "User interviews", place: "Room 2", color: "bg-[#65A30D]" },
  { id: "e7", start: "4:30", end: "5:00", title: "Release check-in", place: "Zoom", color: "bg-[#65A30D]" },
];

const HOURS = ["8 AM", "9 AM", "10 AM", "11 AM", "12 PM", "1 PM", "2 PM", "3 PM", "4 PM", "5 PM"];

/** Event tint: the color bar's hue becomes the block's soft surface. */
const TINT: Record<string, string> = {
  "bg-[#65A30D]": "bg-[#65A30D]/10",
  "bg-success": "bg-success/15",
  "bg-warning": "bg-warning/15",
  "bg-secondary-foreground": "bg-secondary",
};

/** Demo "now" — a red line pinned at 1:24 PM inside the timeline. */
const NOW_ROW = 13 - 8;
const NOW_FRAC = 0.4;

/** Calendar day — hour timeline with event blocks. */
export function CalendarDayScreen({
  day = "Wed, Sep 23",
  events = DEFAULT_EVENTS,
  onEventPress,
  onBack,
}: CalendarDayScreenProps) {
  const insets = useSafeAreaInsets();

  // Map "9:00"/"3:00" → hour-row index; hours after noon are written 1–5.
  const rowFor = (start: string) => {
    const h = parseInt(start.slice(0, start.indexOf(":")), 10);
    return (h < 8 ? h + 12 : h) - 8;
  };

  return (
    <World primary="#65A30D">
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top", "bottom"]}>
      <View className="flex-row items-center gap-2 px-4 pb-1 pt-2">
        <Button
          variant="ghost"
          size="icon"
          haptic="light"
          onPress={() => onBack?.()}
          accessibilityLabel="Go back"
          className="-ml-2 h-10 w-10"
        >
          <Icon name="chevron-left" size="md" color="foreground" />
        </Button>
        <View>
          <Text variant="h2" accessibilityRole="header">
          {day}
        </Text>
          <Text variant="small" className="text-muted-foreground">
            {events.length} events · now 1:24 PM
          </Text>
          {/* Free-stretch intel — the scheduling question people ask. */}
          <Text variant="small" className="text-[11px] text-success">
            Longest free stretch: 3–6 PM
          </Text>
        </View>
      </View>

      <ScrollView
        showsVerticalScrollIndicator={false}
        contentContainerStyle={{ paddingBottom: insets.bottom + 24 }}
      >
        {/* Timeline — hour gutters on the left, blocks in the lane. */}
        <Mount className="px-3 pt-2">
          {HOURS.map((hour, i) => (
            <View key={hour} className="flex-row">
              <Text className="w-12 pt-0 text-right text-[10px] text-muted-foreground">
                {hour}
              </Text>
              <View className="ml-2 h-14 flex-1 border-t border-border/60">
                {i === NOW_ROW && (
                  <View
                    className="absolute inset-x-0 flex-row items-center"
                    style={{ top: NOW_FRAC * 56 }}
                  >
                    <View className="h-1.5 w-1.5 rounded-full bg-destructive" />
                    <View className="h-px flex-1 bg-destructive/70" />
                  </View>
                )}
                {events
                  .filter((e) => rowFor(e.start) === i)
                  .map((e) => (
                    <Press
                      key={e.id}
                      haptic="light"
                      onPress={() => onEventPress?.(e.id)}
                      accessibilityLabel={`${e.title}, ${e.start} to ${e.end}, ${e.place}`}
                      accessibilityRole="button"
                      className={`mt-0.5 flex-row items-start gap-2 rounded-2xl p-2.5 ${TINT[e.color] ?? "bg-secondary"}`}
                    >
                      <View className={`h-full w-1 rounded-full ${e.color}`} />
                      <View className="flex-1 items-start">
                        <Text className="text-sm font-medium">{e.title}</Text>
                        <Text className="text-[10px] text-muted-foreground">
                          {e.start} – {e.end} · {e.place}
                        </Text>
                      </View>
                    </Press>
                  ))}
              </View>
            </View>
          ))}
        </Mount>
      </ScrollView>
    </SafeAreaView>
    </World>
  );
}
CalendarDayScreen.displayName = "CalendarDayScreen";
agent prompt — paste into Claude Code, Cursor, Devin…
Recreate the "Calendar Day Screen" screen in React Native using LumioUI.

Goal: Hour timeline with events 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-calendar-day
```

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

Native packages:
- @lumioui/ui@latest
- react-native-safe-area-context@*
- @lumioui/core@latest
- 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

### `button` — Tactile pill button with press spring, ink wash and async loading.
- `<Button>` ×1

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

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

## 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/calendar-day.tsx` exporting CalendarDayScreen. 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 { ScrollView, View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Button, Icon, Text } from "@lumioui/ui";
import { Mount, Press, World } from "../shared";

export interface DayEvent {
  id: string;
  start: string;
  end: string;
  title: string;
  place: string;
  color: string;
}

export interface CalendarDayScreenProps {
  day?: string;
  events?: DayEvent[];
  onEventPress?: (id: string) => void;
  onBack?: () => void;
}

const DEFAULT_EVENTS: DayEvent[] = [
  { id: "e0", start: "8:00", end: "8:45", title: "Morning run", place: "Embarcadero", color: "bg-success" },
  { id: "e1", start: "9:00", end: "9:45", title: "Standup", place: "Zoom", color: "bg-[#65A30D]" },
  { id: "e2", start: "10:00", end: "10:45", title: "Design review", place: "Studio", color: "bg-warning" },
  { id: "e5", start: "11:00", end: "12:00", title: "Deep work — motion spec", place: "Focus", color: "bg-secondary-foreground" },
  { id: "e3", start: "12:30", end: "1:15", title: "Lunch with Sam", place: "Café Cielo", color: "bg-success" },
  { id: "e6", start: "2:00", end: "2:30", title: "1:1 with Maya", place: "Studio", color: "bg-warning" },
  { id: "e4", start: "3:00", end: "4:00", title: "User interviews", place: "Room 2", color: "bg-[#65A30D]" },
  { id: "e7", start: "4:30", end: "5:00", title: "Release check-in", place: "Zoom", color: "bg-[#65A30D]" },
];

const HOURS = ["8 AM", "9 AM", "10 AM", "11 AM", "12 PM", "1 PM", "2 PM", "3 PM", "4 PM", "5 PM"];

/** Event tint: the color bar's hue becomes the block's soft surface. */
const TINT: Record<string, string> = {
  "bg-[#65A30D]": "bg-[#65A30D]/10",
  "bg-success": "bg-success/15",
  "bg-warning": "bg-warning/15",
  "bg-secondary-foreground": "bg-secondary",
};

/** Demo "now" — a red line pinned at 1:24 PM inside the timeline. */
const NOW_ROW = 13 - 8;
const NOW_FRAC = 0.4;

/** Calendar day — hour timeline with event blocks. */
export function CalendarDayScreen({
  day = "Wed, Sep 23",
  events = DEFAULT_EVENTS,
  onEventPress,
  onBack,
}: CalendarDayScreenProps) {
  const insets = useSafeAreaInsets();

  // Map "9:00"/"3:00" → hour-row index; hours after noon are written 1–5.
  const rowFor = (start: string) => {
    const h = parseInt(start.slice(0, start.indexOf(":")), 10);
    return (h < 8 ? h + 12 : h) - 8;
  };

  return (
    <World primary="#65A30D">
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top", "bottom"]}>
      <View className="flex-row items-center gap-2 px-4 pb-1 pt-2">
        <Button
          variant="ghost"
          size="icon"
          haptic="light"
          onPress={() => onBack?.()}
          accessibilityLabel="Go back"
          className="-ml-2 h-10 w-10"
        >
          <Icon name="chevron-left" size="md" color="foreground" />
        </Button>
        <View>
          <Text variant="h2" accessibilityRole="header">
          {day}
        </Text>
          <Text variant="small" className="text-muted-foreground">
            {events.length} events · now 1:24 PM
          </Text>
          {/* Free-stretch intel — the scheduling question people ask. */}
          <Text variant="small" className="text-[11px] text-success">
            Longest free stretch: 3–6 PM
          </Text>
        </View>
      </View>

      <ScrollView
        showsVerticalScrollIndicator={false}
        contentContainerStyle={{ paddingBottom: insets.bottom + 24 }}
      >
        {/* Timeline — hour gutters on the left, blocks in the lane. */}
        <Mount className="px-3 pt-2">
          {HOURS.map((hour, i) => (
            <View key={hour} className="flex-row">
              <Text className="w-12 pt-0 text-right text-[10px] text-muted-foreground">
                {hour}
              </Text>
              <View className="ml-2 h-14 flex-1 border-t border-border/60">
                {i === NOW_ROW && (
                  <View
                    className="absolute inset-x-0 flex-row items-center"
                    style={{ top: NOW_FRAC * 56 }}
                  >
                    <View className="h-1.5 w-1.5 rounded-full bg-destructive" />
                    <View className="h-px flex-1 bg-destructive/70" />
                  </View>
                )}
                {events
                  .filter((e) => rowFor(e.start) === i)
                  .map((e) => (
                    <Press
                      key={e.id}
                      haptic="light"
                      onPress={() => onEventPress?.(e.id)}
                      accessibilityLabel={`${e.title}, ${e.start} to ${e.end}, ${e.place}`}
                      accessibilityRole="button"
                      className={`mt-0.5 flex-row items-start gap-2 rounded-2xl p-2.5 ${TINT[e.color] ?? "bg-secondary"}`}
                    >
                      <View className={`h-full w-1 rounded-full ${e.color}`} />
                      <View className="flex-1 items-start">
                        <Text className="text-sm font-medium">{e.title}</Text>
                        <Text className="text-[10px] text-muted-foreground">
                          {e.start} – {e.end} · {e.place}
                        </Text>
                      </View>
                    </Press>
                  ))}
              </View>
            </View>
          ))}
        </Mount>
      </ScrollView>
    </SafeAreaView>
    </World>
  );
}
CalendarDayScreen.displayName = "CalendarDayScreen";
```

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