@moltenship/calendar 1.0.0-rc.1 → 2.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +24 -4
  2. package/dist/index.d.mts +2 -2
  3. package/docs/accessibility.md +304 -0
  4. package/docs/agents/changes.md +449 -0
  5. package/docs/agents/coding-agents.md +117 -0
  6. package/docs/agents/connect.md +435 -0
  7. package/docs/agents/deleting.md +296 -0
  8. package/docs/agents/reference.md +512 -0
  9. package/docs/agents/server.md +317 -0
  10. package/docs/agents/webmcp.md +153 -0
  11. package/docs/agents.md +353 -0
  12. package/docs/annotations.md +196 -0
  13. package/docs/api/changes.md +248 -0
  14. package/docs/api/dnd-kit.md +267 -0
  15. package/docs/api/events.md +152 -0
  16. package/docs/api/ics.md +524 -0
  17. package/docs/api/primitives.md +168 -0
  18. package/docs/api/react.md +236 -0
  19. package/docs/api/recurrence.md +586 -0
  20. package/docs/api/solid.md +460 -0
  21. package/docs/api/store.md +92 -0
  22. package/docs/api/temporal.md +172 -0
  23. package/docs/api.md +57 -0
  24. package/docs/availability.md +573 -0
  25. package/docs/comparison.md +279 -0
  26. package/docs/concepts/anatomy.md +73 -0
  27. package/docs/concepts/events.md +164 -0
  28. package/docs/concepts/how-it-works.md +95 -0
  29. package/docs/concepts/recurrence.md +127 -0
  30. package/docs/concepts/state.md +244 -0
  31. package/docs/concepts/time.md +170 -0
  32. package/docs/guides/dnd-kit.md +333 -0
  33. package/docs/guides/google-calendar-sync.md +1246 -0
  34. package/docs/guides/google-calendar.md +367 -0
  35. package/docs/guides/ics.md +486 -0
  36. package/docs/guides/motion.md +414 -0
  37. package/docs/guides/nextjs-app-router.md +630 -0
  38. package/docs/guides/nextjs.md +149 -0
  39. package/docs/guides/performance.md +103 -0
  40. package/docs/guides/recurring-events.md +583 -0
  41. package/docs/guides/tanstack-query.md +485 -0
  42. package/docs/index.md +118 -0
  43. package/docs/installation.md +194 -0
  44. package/docs/interactions.md +408 -0
  45. package/docs/llms.txt +86 -0
  46. package/docs/migrating-to-2.md +322 -0
  47. package/docs/quick-start.md +159 -0
  48. package/docs/stylex.md +265 -0
  49. package/docs/testing.md +581 -0
  50. package/docs/theme-builder.md +81 -0
  51. package/docs/theming.md +169 -0
  52. package/docs/undo-redo.md +339 -0
  53. package/docs/views/agenda.md +221 -0
  54. package/docs/views/custom-views.md +192 -0
  55. package/docs/views/month.md +109 -0
  56. package/docs/views/resource-columns.md +261 -0
  57. package/docs/views/resource-timeline.md +225 -0
  58. package/docs/views/scrolling.md +192 -0
  59. package/docs/views/week-and-day.md +257 -0
  60. package/docs/views/year.md +138 -0
  61. package/docs/views.md +69 -0
  62. package/package.json +41 -14
  63. package/skills/moltenship-time/SKILL.md +75 -0
  64. package/skills/moltenship-time/references/agent-ready.md +272 -0
  65. package/skills/moltenship-time/references/changes.md +188 -0
  66. package/skills/moltenship-time/references/compose.md +168 -0
  67. package/skills/moltenship-time/references/mistakes.md +98 -0
  68. package/skills/moltenship-time/references/solid.md +202 -0
  69. package/skills/moltenship-time/references/state.md +129 -0
  70. package/skills/moltenship-time/references/testing.md +176 -0
@@ -0,0 +1,261 @@
1
+ # Resource columns
2
+
3
+ A day or a few days of rooms or people side by side, grouped by team, with hundreds of columns.
4
+
5
+ Source: https://time.molten.sh/docs/views/resource-columns
6
+
7
+ > Live example of the `resources` view: see it at https://time.molten.sh/docs/views/resource-columns
8
+
9
+ Try it in the [live demo](https://moltenship-time-demo.vercel.app): pick Resources in the view
10
+ switcher.
11
+
12
+ `createResourceColumnsView` shows one time-grid column for each resource, such as a room or a
13
+ person, for the anchor date. Pass a number of days to give each resource that many day columns.
14
+ Resources with children appear as groups that collapse. Only the columns in view are rendered, so
15
+ the view stays fast with hundreds of resources.
16
+
17
+ ## Add it
18
+
19
+ Add the view to your app with the shadcn CLI, as described in
20
+ [UI source](../installation.md#ui-source-optional). The item brings `time-grid-view`, whose
21
+ columns, events and all-day row it reuses, the theme, the shared `calendar` parts, and
22
+ `@tanstack/react-virtual`:
23
+
24
+ ```bash
25
+ npx shadcn@latest add https://time.molten.sh/r/resource-columns-view.json
26
+ ```
27
+
28
+ ```tsx
29
+ import { createResourceColumnsView } from "@/components/calendar/resource-columns-view/resource-columns-view";
30
+
31
+ export const Calendar = createCalendar<Meeting, Room>()({
32
+ eventAdapter,
33
+ views: [createResourceColumnsView<Meeting>({ getEventColor: (meeting) => meeting.color })],
34
+ });
35
+ ```
36
+
37
+ The view is named `resources`. Previous and Next move by its number of days:
38
+ `createResourceColumnsView<Meeting>(options, 3)` shows three days for each resource.
39
+
40
+ ## Resources
41
+
42
+ Pass the resources to `Root`. Each one has an `id`, a `title`, and optionally a `parentId`, which
43
+ puts it in a group under that resource. Events list the resources they book in `resourceIds`, read
44
+ through your event adapter's `getResourceIds`. An event that books several resources shows in each
45
+ of their columns.
46
+
47
+ ```tsx
48
+ const rooms = [
49
+ { data: null, id: "floor-1", title: "First floor" },
50
+ { data: null, id: "orchid", parentId: "floor-1", title: "Orchid" },
51
+ { data: null, id: "lotus", parentId: "floor-1", title: "Lotus" },
52
+ ];
53
+
54
+ <Calendar.Root resources={rooms} defaultExpandedResourceIds={["floor-1"]} /* … */>
55
+ ```
56
+
57
+ A group's children show while its ID is in `expandedResourceIds`. The chevron on a group's header
58
+ toggles it. To control expansion yourself, pass `expandedResourceIds` and
59
+ `onExpandedResourceIdsChange`. Groups start collapsed unless you list them in
60
+ `defaultExpandedResourceIds`.
61
+
62
+ ## Avatars and icons
63
+
64
+ Columns often mix people and rooms, and a bare name doesn't say which is which. To show it, pass
65
+ your own `ResourceHeader`. It draws each header's name row from small parts, so you can put a
66
+ person's avatar or a room's icon before the name, as the preview above does. Teams there keep just
67
+ their chevron.
68
+
69
+ Keep what the header needs in each resource's `data`, and give it a type. The view takes it as its
70
+ second type parameter, so the component can read it:
71
+
72
+ ```tsx
73
+ import type { CalendarResource } from "@moltenship/calendar";
74
+ import { DoorOpenIcon } from "lucide-react";
75
+
76
+ import {
77
+ ResourceHeaderIcon,
78
+ ResourceHeaderTitle,
79
+ ResourceHeaderToggle,
80
+ type ResourceHeaderProps,
81
+ } from "@/components/calendar/resource-columns-view/resource-header";
82
+ import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
83
+
84
+ // For example { data: { avatar: "/avatars/maya.png", kind: "person" }, id: "maya", title: "Maya" }
85
+ type Resource = CalendarResource<
86
+ { kind: "room" } | { kind: "team" } | { avatar: string; kind: "person" }
87
+ >;
88
+ ```
89
+
90
+ Then compose the parts: the chevron, an avatar for a person or a door for a room, and the name.
91
+ Pass the component to the view:
92
+
93
+ ```tsx
94
+ function ResourceHeader({ resource, title }: ResourceHeaderProps<Resource>) {
95
+ return (
96
+ <>
97
+ <ResourceHeaderToggle />
98
+ {resource?.data.kind === "person" && (
99
+ <ResourceHeaderIcon>
100
+ <Avatar size="sm">
101
+ <AvatarImage alt="" src={resource.data.avatar} />
102
+ <AvatarFallback>{title.slice(0, 1)}</AvatarFallback>
103
+ </Avatar>
104
+ </ResourceHeaderIcon>
105
+ )}
106
+ {resource?.data.kind === "room" && (
107
+ <ResourceHeaderIcon className="size-6 justify-center rounded-md bg-muted text-muted-foreground">
108
+ <DoorOpenIcon className="size-3.5" />
109
+ </ResourceHeaderIcon>
110
+ )}
111
+ <ResourceHeaderTitle />
112
+ </>
113
+ );
114
+ }
115
+
116
+ const view = createResourceColumnsView<Meeting, Resource>({ ResourceHeader });
117
+ ```
118
+
119
+ The parts live in `resource-header.tsx`:
120
+
121
+ - `ResourceHeaderToggle` is a group's chevron. It renders nothing for a resource without children.
122
+ - `ResourceHeaderIcon` wraps anything you draw before the name. Screen readers skip it, because the
123
+ name beside it already says who or what the column is.
124
+ - `ResourceHeaderTitle` is the name, cut short with an ellipsis. Children replace it.
125
+ - `useResourceHeader()` gives your own parts the resource, its name and its groups.
126
+ `DefaultResourceHeader` is the toggle and the title.
127
+
128
+ `resource` is `null` for the Unassigned column. The view keeps the rest of the header: the group
129
+ bands, the row heights and the group names screen readers hear. A row is 2rem tall, so keep
130
+ icons at 24px (`size-6`) or smaller. `Avatar` is shadcn's: `npx shadcn@latest add avatar`. It
131
+ shows the fallback, here the person's initial, until the image loads.
132
+
133
+ ## Rooms and people
134
+
135
+ Rooms and people often want different layouts. A room's bookings can stack, so a busy room reads
136
+ at a glance, while a person's meetings sit side by side. `getResourceOverlapLayout` gives each
137
+ resource's columns a layout of its own; it takes the resource with your `data` type, so it can read
138
+ what kind it is:
139
+
140
+ > Live example: see it at https://time.molten.sh/docs/views/resource-columns
141
+
142
+ ```tsx
143
+ const view = createResourceColumnsView<Meeting, Resource>({
144
+ getResourceOverlapLayout: (resource) => (resource.data.kind === "room" ? "stack" : undefined),
145
+ overlapLayout: "columns",
146
+ });
147
+ ```
148
+
149
+ The most specific layout wins, and each `undefined` falls through to the next:
150
+
151
+ 1. An event's own layout, from `getEventOverlapLayout`, such as its calendar's. A group of
152
+ overlapping events takes it only when they all agree, as in the
153
+ [week and day views](./week-and-day.md#by-calendar).
154
+ 2. The column's resource, from `getResourceOverlapLayout`.
155
+ 3. The view's `overlapLayout`, then `"columns"`.
156
+
157
+ A group whose events disagree takes its column's layout, from 2 or 3. The Unassigned column isn't
158
+ a resource, so it follows `overlapLayout`. An event that books a room and a person is laid out in
159
+ each column by that column's layout, and a move to another resource redraws it there by the new
160
+ one's, also while the change is still saving. Keyboard focus and the drawing order follow what's
161
+ drawn in each column: ↑ and ↓ walk its events top to bottom, and ← and → step to the overlapping
162
+ event drawn beside.
163
+
164
+ Whether a room may be double-booked at all is a separate rule, with a mode per resource too: see
165
+ [double booking](../availability.md#double-booking).
166
+
167
+ ## Anatomy
168
+
169
+ `ResourceColumnsView` renders the parts below. The view builds them itself from its projection, so
170
+ they're not parts you compose: to change one, edit its file. The exception is each header's name
171
+ row, which you can replace with [`ResourceHeader`](#avatars-and-icons). The tree shows where each
172
+ part lives.
173
+
174
+ > Diagram: see it at https://time.molten.sh/docs/views/resource-columns
175
+
176
+ ```txt title="Rendered by ResourceColumnsView"
177
+ ResourceColumnsView resource-columns-view.tsx
178
+ ├── ResourceColumnsHeader resource-columns-header.tsx
179
+ │ └── Resource header one per rendered resource
180
+ │ └── ResourceHeader resource-header.tsx, or your own composition
181
+ ├── ResourceColumnsDates resource-columns-dates.tsx, over N days
182
+ ├── ResourceColumnsAllDay resource-columns-all-day.tsx
183
+ │ └── TimeGridAllDayCells one set per rendered resource
184
+ └── ResourceColumnsBody resource-columns-body.tsx, scrolls both ways
185
+ ├── Time gutter --calendar-gutter-width, with secondary time zones
186
+ └── Resource column data-resource-id
187
+ └── TimeGridColumn time-grid-column.tsx, one per day
188
+ ├── TimeGridEvent time-grid-event.tsx
189
+ └── Now line data-slot="time-grid-now"
190
+ ```
191
+
192
+ - `useColumnVirtualizer` in `column-virtualizer.ts` decides which columns render. Columns share the
193
+ width until they are 128px per day, then the view scrolls sideways.
194
+ - The header, all-day row and gutter sit beside the scrolling body, not over it. `useAxisSync` in
195
+ `axis-sync.ts` moves them with the body's scroll, so a drag never lands on a column hidden behind
196
+ them.
197
+
198
+ ## Options
199
+
200
+ | Name | Type | Default | Description |
201
+ | -------------------------- | ----------------------------------------------------------------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
202
+ | `describeEvent` | `(event: TEvent) => string \| undefined` | | Extra words for each event's accessible name, such as its calendar. |
203
+ | `getEventColor` | `(event: TEvent) => CalendarEventColor \| undefined` | | The color for each event. See [event colors](../theming.md#event-colors). |
204
+ | `getEventIcon` | `(event: TEvent) => ReactNode` | | A small icon before each event's title, such as a repeat mark on recurring events, or nothing. It's decorative and hidden from screen readers: say the same in `describeEvent`, which adds to the event's [accessible name](../accessibility.md#event-names). |
205
+ | `getEventOverlapLayout` | `(event: TEvent) => "columns" \| "equal" \| "stack" \| undefined` | | An event's own layout, such as its calendar's, as in the [week and day views](./week-and-day.md#by-calendar). A group that disagrees takes its column's. |
206
+ | `getResourceOverlapLayout` | `(resource: TResource) => "columns" \| "equal" \| "stack" \| undefined` | | A resource's layout in its columns, such as `"stack"` for rooms; `undefined` keeps `overlapLayout`. See [rooms and people](#rooms-and-people). |
207
+ | `overlapLayout` | `"columns" \| "equal" \| "stack"` | `"columns"` | How overlapping events share a resource's column, as in the [week and day views](./week-and-day.md#overlapping-events), unless `getResourceOverlapLayout` gives the resource its own. |
208
+ | `ResourceHeader` | `ComponentType<ResourceHeaderProps<TResource>>` | `DefaultResourceHeader` | Draws each header's name row from the `resource-header.tsx` parts. See [avatars and icons](#avatars-and-icons). |
209
+ | `stackIndent` | `number` | `0.15` | How far each level of a stack is indented, as a fraction of the column width, the same for every stacked group. A value that isn't positive throws, whatever the layout. |
210
+ | `unassigned` | `"hide" \| "bucket"` | `"hide"` | Events that book no resources: hidden, or shown in an "Unassigned" column after the resources. |
211
+ | `renderUnavailable` | `UnavailableTimeRender` | | Replaces the shading of closed time: an element, or a function of its props. See [customize the shading](../availability.md#customize-the-shading). |
212
+ | `resourceStatus` | `boolean \| ResourceStatusOptions` | | Shows each resource's status, such as "Busy until 3:00 PM". See [busy badge](../availability.md#busy-badge-in-resource-views). |
213
+
214
+ Set options when you create the view, or per calendar with
215
+ `viewOptions={{ resources: { unassigned: "bucket" } }}` on `Root`.
216
+
217
+ ## What it shows
218
+
219
+ - **Header:** each resource's name, or what your `ResourceHeader` draws. An expanded group's band
220
+ names it across its own column and its children's columns. Over several days, a row under the
221
+ names shows each day's weekday and date.
222
+ - **All-day row:** each resource's all-day events, and timed events of 24 hours or more. Busy days
223
+ collapse to three rows with "+N more" in every column at once, so the row keeps one height.
224
+ - **Columns:** the same hours, events, daylight-saving bands and now line as the
225
+ [day view](./week-and-day.md).
226
+ - **Editing:** with `onEventChange` on `Root`, drag an event within its column to move or resize it,
227
+ or into another resource's column to move it there. A move swaps the resource you dragged from
228
+ for the one you dropped on and keeps the event's other resources. Drag across empty time or
229
+ all-day cells to create an event in that resource. See
230
+ [Interactions](../interactions.md#drag-resize-and-create).
231
+ - **Accessible names:** events, slots and all-day cells include their resource, as in "Design
232
+ review, Tuesday, October 6, 10:00 – 11:30 AM, Orchid". Announcements name it too: "Moved Design
233
+ review to Tuesday, October 6, 10:00 – 11:30 AM, Cedar, Maya, Alex."
234
+
235
+ ## Keyboard
236
+
237
+ Tab into the preview above, or click a slot, and try these keys. Columns run resource by resource:
238
+ each resource's days, then the next resource. Inside a column the keys are the
239
+ [day view's](./week-and-day.md#keyboard). The
240
+ [Accessibility](../accessibility.md#keyboard) page has the full map and what a screen reader hears.
241
+
242
+ | Focus | Key | Effect |
243
+ | ------------- | ------------------ | -------------------------------------------------------------------------------------------- |
244
+ | A day or slot | ← → | Same slot in the previous or next column, crossing into the next resource |
245
+ | A day or slot | ← → past the ends | On to the day before or after the range, in the last or first resource |
246
+ | A day or slot | Home, End | First or last column |
247
+ | A day or slot | Page Up, Page Down | Same resource, a whole day (or range) earlier or later |
248
+ | A day or slot | ↑ ↓, Enter | As in the day view: slots, the all-day cell, and the events covering a slot |
249
+ | A day or slot | Space | Start an event there, in that column's resource |
250
+ | An event | Space | Pick it up. ← → move it across columns, and into another resource it swaps that one resource |
251
+
252
+ Focus can move to a resource that's scrolled out of view: its column renders and scrolls in, and
253
+ it stays rendered while you scroll away, so focus is never lost.
254
+
255
+ ## Markup for interactions
256
+
257
+ The view connects the pointer layer for you. Each resource's cells sit inside an element with
258
+ `resourceIdAttributes(id)`, which sets `data-resource-id`: a drop or create inside it lands in that
259
+ resource. Inside, the attributes are the [day view's](./week-and-day.md#markup-for-interactions):
260
+ `data-date` on day columns and all-day cells, `data-all-day` on all-day cells, `data-event-id` on
261
+ events, and `data-resize` handles.
@@ -0,0 +1,225 @@
1
+ # Resource timeline
2
+
3
+ Rooms or people as rows and time as columns, for a day, a week or a month, with hundreds of rows.
4
+
5
+ Source: https://time.molten.sh/docs/views/resource-timeline
6
+
7
+ > Live example of the `timeline` view: see it at https://time.molten.sh/docs/views/resource-timeline
8
+
9
+ Try it in the [live demo](https://moltenship-time-demo.vercel.app): pick Timeline in the view
10
+ switcher.
11
+
12
+ `createTimelineDayView`, `createTimelineWeekView` and `createTimelineMonthView` show one row for
13
+ each resource, such as a room or a person, with time running across. A day is split into hours, and
14
+ a week or a month into days. Each resource's events are bars in its row. Resources with children
15
+ appear as groups that collapse. Only the rows and slots in view are rendered, so the timeline stays
16
+ fast with hundreds of resources over a whole month.
17
+
18
+ ## Add it
19
+
20
+ Add the view to your app with the shadcn CLI, as described in
21
+ [UI source](../installation.md#ui-source-optional). The item brings the theme, the shared
22
+ `calendar` parts, shadcn's `button`, and `@tanstack/react-virtual`:
23
+
24
+ ```bash
25
+ npx shadcn@latest add https://time.molten.sh/r/resource-timeline-view.json
26
+ ```
27
+
28
+ ```tsx
29
+ import {
30
+ createTimelineDayView,
31
+ createTimelineMonthView,
32
+ createTimelineWeekView,
33
+ } from "@/components/calendar/resource-timeline-view/resource-timeline-view";
34
+
35
+ const getEventColor = (meeting: Meeting) => meeting.color;
36
+
37
+ export const Calendar = createCalendar<Meeting, Room>()({
38
+ eventAdapter,
39
+ views: [
40
+ createTimelineDayView<Meeting>({ getEventColor }),
41
+ createTimelineWeekView<Meeting>({ getEventColor }),
42
+ createTimelineMonthView<Meeting>({ getEventColor }),
43
+ ],
44
+ });
45
+ ```
46
+
47
+ The views are named `timeline-day`, `timeline-week` and `timeline-month`. The week starts on
48
+ `weekRules.firstDay`, and the month view shows the anchor's calendar month, from the 1st to its last
49
+ day. Previous and Next move by a day, a week or a month.
50
+
51
+ ## Resources
52
+
53
+ Pass the resources to `Root`, as for [resource columns](./resource-columns.md#resources).
54
+ Each one has an `id`, a `title`, and optionally a `parentId`, which puts it in a group under that
55
+ resource. Events list the resources they book in `resourceIds`, read through your event adapter's
56
+ `getResourceIds`. An event that books several resources shows in each of their rows.
57
+
58
+ ```tsx
59
+ const rooms = [
60
+ { data: null, id: "floor-1", title: "First floor" },
61
+ { data: null, id: "orchid", parentId: "floor-1", title: "Orchid" },
62
+ { data: null, id: "lotus", parentId: "floor-1", title: "Lotus" },
63
+ ];
64
+
65
+ <Calendar.Root resources={rooms} defaultExpandedResourceIds={["floor-1"]} /* … */>
66
+ ```
67
+
68
+ A group's children show while its ID is in `expandedResourceIds`. The chevron beside a group's name
69
+ toggles it. To control expansion yourself, pass `expandedResourceIds` and
70
+ `onExpandedResourceIdsChange`. Groups start collapsed unless you list them in
71
+ `defaultExpandedResourceIds`.
72
+
73
+ ## Anatomy
74
+
75
+ `ResourceTimelineView` renders the parts below. The view builds them itself from its projection, so
76
+ they're not parts you compose: to change one, edit its file. The tree shows where each part lives.
77
+
78
+ > Diagram: see it at https://time.molten.sh/docs/views/resource-timeline
79
+
80
+ ```txt title="Rendered by ResourceTimelineView"
81
+ ResourceTimelineView resource-timeline-view.tsx
82
+ └── ResourceTimelineGrid resource-timeline-grid.tsx, scrolls both ways
83
+ ├── ResourceTimelineHeader resource-timeline-header.tsx, sticky at the top
84
+ │ ├── Date or month stays in view while you scroll sideways
85
+ │ └── Hour or day one per rendered slot
86
+ ├── ResourceTimelineRow resource-timeline-row.tsx, one per rendered resource
87
+ │ ├── Resource name sticky at the inline start, with a group's toggle
88
+ │ └── Cell one per rendered slot
89
+ │ ├── Day data-date, in a week or a month
90
+ │ ├── Date strip data-axis="inline" and data-date, in a day
91
+ │ ├── ResourceTimelineEvent resource-timeline-event.tsx
92
+ │ └── Keyboard cursor resource-timeline-focus.tsx, on the focused cell
93
+ └── Now line data-slot="resource-timeline-now"
94
+ ```
95
+
96
+ - `useTimelineVirtualizer` in `use-timeline-virtualizer.ts` decides which rows and slots render:
97
+ the ones in view, a few beyond, and the focused ones. Slots share the width the resource column
98
+ leaves until they are 56px for an hour or 48px for a day, then the view scrolls sideways. The
99
+ resource column is 208px wide, or 128px on narrow screens.
100
+ - The header and the resource column are `position: sticky` inside the one scrolling element, so
101
+ they move with it exactly and a row's name stays inside its row for screen readers.
102
+ - `timeline-placement.ts` puts each bar in the first rendered cell it covers, so a bar that starts
103
+ off-screen still shows. A row is as tall as its lanes, or its stacks, need, and at least 44px.
104
+
105
+ ## Options
106
+
107
+ | Name | Type | Default | Description |
108
+ | -------------------------- | ----------------------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
109
+ | `describeEvent` | `(event: TEvent) => string \| undefined` | | Extra words for each event's accessible name, such as its calendar. |
110
+ | `getEventColor` | `(event: TEvent) => CalendarEventColor \| undefined` | | The color for each event. See [event colors](../theming.md#event-colors). |
111
+ | `getEventIcon` | `(event: TEvent) => ReactNode` | | A small icon before each event's title, such as a repeat mark on recurring events, or nothing. It's decorative and hidden from screen readers: say the same in `describeEvent`, which adds to the event's [accessible name](../accessibility.md#event-names). |
112
+ | `getEventOverlapLayout` | `(event: TEvent) => "columns" \| "equal" \| "stack" \| undefined` | | In an hour timeline, an event's own layout, such as its calendar's: a group of overlapping events in a row takes it when they all agree. See [stacked rows](#stacked-rows). |
113
+ | `getResourceOverlapLayout` | `(resource: TResource) => "columns" \| "equal" \| "stack" \| undefined` | | In an hour timeline, a resource's layout in its row, such as `"stack"` for rooms; `undefined` keeps `overlapLayout`. |
114
+ | `overlapLayout` | `"columns" \| "equal" \| "stack"` | `"columns"` | In an hour timeline, how a row shares out overlapping events: a lane for each level of overlap, or `"stack"` to cascade them. See [stacked rows](#stacked-rows). |
115
+ | `slotUnit` | `"hour" \| "day"` | | What a column spans: hours for a day and days for a week or a month unless you set it. |
116
+ | `unassigned` | `"hide" \| "bucket"` | `"hide"` | Events that book no resources: hidden, or shown in an "Unassigned" row after the resources. |
117
+ | `renderUnavailable` | `UnavailableTimeRender` | | Replaces the shading of closed time and closed days: an element, or a function of its props. See [customize the shading](../availability.md#customize-the-shading). |
118
+ | `resourceStatus` | `boolean \| ResourceStatusOptions` | | Shows each resource's status, such as "Busy until 3:00 PM". See [busy badge](../availability.md#busy-badge-in-resource-views). |
119
+
120
+ Set options when you create the view, or per calendar with
121
+ `viewOptions={{ "timeline-week": { unassigned: "bucket" } }}` on `Root`.
122
+
123
+ ## What it shows
124
+
125
+ - **Header:** the hours under their date, or the days under their month with today highlighted and
126
+ marked `aria-current="date"`. Weekends are tinted down every row.
127
+ - **Rows:** each resource's name, indented under its group. Groups are tinted, and their chevron
128
+ shows or hides their children.
129
+ - **Events over days:** laid out like a [month](./month.md) row. A timed event within one
130
+ day shows its title and start time, as "Standup 9:30 AM", and drops the time when the day is too
131
+ narrow. Longer events span their days.
132
+ - **Events over hours:** each bar spans its exact times, on the same 24-hour wall clock as the
133
+ [day view](./week-and-day.md). Hours skipped when the clocks go forward are hatched, and
134
+ hours repeated when they go back are tinted.
135
+ - **Both:** an event that starts before or ends after the range is squared off at that edge.
136
+ Events that overlap sit in lanes, and the row grows to fit them. Over hours, a row can
137
+ [stack](#stacked-rows) them instead.
138
+ - **Current time:** a line through today at the current time, from
139
+ [`useNow()`](../concepts/time.md#the-current-time). A day opens scrolled to it, or to 08:00 when
140
+ today isn't shown.
141
+ - **Editing:** with `onEventChange` on `Root`, drag an event along its row to move it, or onto
142
+ another row to move it to that resource. A move swaps the resource you dragged from for the one
143
+ you dropped on and keeps the event's other resources. Drag an event's start or end edge to resize
144
+ it, and drag across empty time to create an event in that resource. Over days these steps are
145
+ whole days, and an event keeps its time; over hours they're half hours. See
146
+ [Interactions](../interactions.md#drag-resize-and-create).
147
+ - **Accessible names:** the grid is named after the range, each row after its resource, and each
148
+ cell after its resource, time and number of events, as in "Orchid, Monday, October 5, 2026, 2
149
+ events". Events end with their resource, as in "Design review, Tuesday, October 6, 10:00 – 11:30
150
+ AM, Orchid".
151
+
152
+ A day of rooms and people, in hours:
153
+
154
+ > Live example of the `timeline-day` view: see it at https://time.molten.sh/docs/views/resource-timeline
155
+
156
+ ## Stacked rows
157
+
158
+ A busy room takes a lane for each level of overlap, so its row grows. In an hour timeline,
159
+ `overlapLayout: "stack"` cascades a row's overlapping events instead: each bar sits a third of a
160
+ lane below the one it covers and is drawn over it, and a deep stack steps less, so the row is never
161
+ more than two lanes tall. `getResourceOverlapLayout` picks it per resource, as in
162
+ [resource columns](./resource-columns.md#rooms-and-people):
163
+
164
+ > Live example of the `timeline-day` view: see it at https://time.molten.sh/docs/views/resource-timeline
165
+
166
+ ```tsx
167
+ const view = createTimelineDayView<Meeting, Resource>({
168
+ getResourceOverlapLayout: (resource) => (resource.data.kind === "room" ? "stack" : undefined),
169
+ });
170
+ ```
171
+
172
+ - `"columns"` and `"equal"` are the same here: a lane per level of overlap. A row has no fixed
173
+ height to share, so no bar narrows.
174
+ - A group's deepest bar sets its step, so a long booking under a busy stretch, such as a desk
175
+ booked all day, compresses every cascade in it. Hover or focus a covered bar to bring it up.
176
+ - The rules are the time grid's. A group of overlapping events takes its events' own layout,
177
+ from `getEventOverlapLayout`, when they all agree, and otherwise its row's. A group's layout
178
+ depends only on its own events. The Unassigned row follows `overlapLayout`.
179
+ - Bars are drawn in time order, so each covers the ones before it. A covered bar rises while you
180
+ hover over it or focus it, so its title shows. ← and → walk a row's bars in the same order, and
181
+ Enter on a cell starts at the bar the others cover, as in lanes.
182
+ - A day timeline lays each row out like a month row, whatever the layout, as the time grid's
183
+ all-day row does.
184
+
185
+ ## Keyboard
186
+
187
+ Tab into a preview, or click a cell, and try these keys. The
188
+ [Accessibility](../accessibility.md#keyboard) page has the full map and what a screen reader hears.
189
+
190
+ | Focus | Key | Effect |
191
+ | -------------- | ------------------ | ------------------------------------------------------------------------ |
192
+ | A cell | ← → | Previous or next day, or half hour in a day |
193
+ | A cell | ↑ ↓ | The same time in the previous or next row |
194
+ | A cell | Home, End | The first or last day or half hour shown |
195
+ | A cell | Page Up, Page Down | Back or forward a whole day, week or month |
196
+ | A cell | Enter | The events covering it in that row. Escape goes back to the event's cell |
197
+ | An event | ← → | Previous or next event in the row |
198
+ | An event | ↑ ↓ | The cell at its start in the previous or next row |
199
+ | A group's cell | Shift+Enter | Expand or collapse the group |
200
+ | A day | Space | Start an all-day event there. Arrow keys extend it, and Enter saves it |
201
+ | A half hour | Space | Start an hour-long event there. Arrow keys extend it, and Enter saves it |
202
+ | An event | Space | Pick it up. Arrow keys move it along its row and to other rows |
203
+ | An event | Shift+Space | Pick up its end to resize it. Shift+Space again switches to its start |
204
+
205
+ Enter drops a picked-up event and Escape puts it back. Moving it to another row moves it to that
206
+ resource, the same change as dropping it there with the pointer, and
207
+ [announcements](../accessibility.md#announcements) name the resource: "Moved Design review to
208
+ Tuesday, October 6, 10:00 – 11:30 AM, Lotus." Focus is a resource and a time, not an element, so
209
+ it survives scrolling: the focused row and slot keep rendering wherever you scroll, and each key
210
+ brings its target into view.
211
+
212
+ ## Markup for interactions
213
+
214
+ The view connects the pointer layer for you. Each resource's row has `resourceIdAttributes(id)`,
215
+ which sets `data-resource-id`: a drop or create inside it lands in that resource.
216
+
217
+ - **Over days:** each day cell has an inner element with `data-date`, beside the events rather than
218
+ around them, so dragging an event by a later day moves it from that day.
219
+ - **Over hours:** each row has a `data-axis="inline"` strip with `data-date` for every date, and
220
+ the view passes its projection's `columns` to the pointer layer, which maps a position along the
221
+ strip to a wall time.
222
+ - **Events:** they're buttons with `data-event-id`, and events you can edit have
223
+ `data-resize="start"` and `data-resize="end"` handles.
224
+ - **Sticky parts:** the header and each row's name have `data-occludes`, so the pointer layer
225
+ doesn't look through them to the cells scrolled beneath.