Add the Nook "Schedule" component to this project, exactly as Nook ships it.
Events in a local-time day, week, month, or year. Overlapping meetings share the available width.
Steps
1. Check for `nook.json` in the project root. If it is missing, run `npx nook-ui@latest init` first (React or Next.js with Tailwind CSS v4). It adds the Nook tokens, the theme and `cn()`.
2. Run `npx nook-ui@latest add schedule`. It writes `components/ui/schedule.tsx` together with everything the component needs. Do not write the component from memory.
3. If you cannot run commands, fetch http://localhost:3000/r/schedule.json, write every entry of `files` to the path it names, install the packages in `dependencies`, and repeat for each name in `registryDependencies`.
4. Use it where I ask. Start from this example:
```tsx
"use client";
import * as React from "react";
import { Schedule, type ScheduleEvent } from "@/components/ui/schedule";
const events: ScheduleEvent[] = [
{ id: "planning", title: "Plan the release", start: "2026-11-16T09:00:00", end: "2026-11-16T10:00:00", location: "Studio A" },
{ id: "research", title: "Customer interviews", start: "2026-11-16T09:30:00", end: "2026-11-16T11:00:00", tone: "muted" },
{ id: "review", title: "Design review", start: "2026-11-17T10:00:00", end: "2026-11-17T11:00:00", location: "Studio B" },
{ id: "focus", title: "Writing time", start: "2026-11-18T13:00:00", end: "2026-11-18T15:00:00", tone: "accent" },
{ id: "demo", title: "Product demo", start: "2026-11-19T14:00:00", end: "2026-11-19T15:00:00" },
{ id: "launch", title: "Release day", start: "2026-11-20T00:00:00", end: "2026-11-21T00:00:00", allDay: true },
{ id: "offsite", title: "Team offsite", start: "2026-12-09T00:00:00", end: "2026-12-11T00:00:00", allDay: true },
{ id: "retro", title: "Quarterly reflection", start: "2026-09-25T14:00:00", end: "2026-09-25T16:00:00" },
];
export default function ScheduleDefault() {
const [message, setMessage] = React.useState("A week at the product studio.");
return
setMessage(`${event.title}${event.location ? ` · ${event.location}` : ""}`)} onSlotSelect={(start) => setMessage(`Selected ${new Date(start).toLocaleString("en-US", { dateStyle: "medium", timeStyle: "short" })}.`)} />{message}
;
}
```
API
- `Schedule`: A calendar with its toolbar. Event end times are exclusive. Use ISO datetimes with offsets to identify instants; display follows the viewer’s local zone.
- `events` (`ScheduleEvent[]`): Each event has id, title, start, end, optional allDay, tone (brand, muted, accent), and location.
- `view, defaultView` (`"day" | "week" | "month" | "year"`, default week): Controlled view, or the first view.
- `date, defaultDate` (`Date`): Controlled anchor day, or the first day. Without either, waits until mount to read today.
- `today` (`Date`): Clock for today and the current-time line. Useful for deterministic rendering.
- `onViewChange, onDateChange` (`(view: ScheduleView) => void, (date: Date) => void`): Called by navigation and when a year or month day opens the day view.
- `onEventSelect` (`(event: ScheduleEvent) => void`): Open event details in your app.
- `onSlotSelect` (`(start: string, end: string) => void`): Receives a one-hour slot as ISO instants.
- `weekStartsOn, locale` (`0 | 1, string`, default 1, en-US): Sunday or Monday first, and the locale for labels.
- `ScheduleToolbar`: Previous, today, next, the range title and a ToggleGroup view switcher; also usable separately.
- `date, view, onDateChange, onViewChange` (`Date, ScheduleView, callbacks`): The current range and navigation handlers.
- `today, weekStartsOn, locale` (`Date, 0 | 1, string`): Same display settings as Schedule.
- Variant `view`: day, week, month, year (default week)
Rules
- Colors, radii, shadows and motion come from Nook tokens and classes such as `bg-primary`, `text-muted-foreground`, `border-border`, `rounded-lg` and `h-control`. Never hard-code them.
- Do not restyle or simplify the file. Change how it looks through `className`, its props and the theme.
- It must keep working with the keyboard, in light and dark mode, and in the sharp, soft and bold styles.
- Accessibility: Arrow keys move between days and hours. Enter chooses a day or slot; event buttons announce their full time range and location. The week scrolls with a sticky time column. Today is read after mount unless supplied.
Done when the component renders like the example in light and dark mode and the project type-checks.