Calendar
The week as a time grid, or the month as a grid of events, each in a finished card with a header.
Built from WeekCalendar, MonthCalendar and CalendarEvent, plus SegmentedControl and Button. Each has a header (the month, a line about what is in view, previous / Today / next and New event) and a card that opens on an event: when, where, which calendar, Delete and Done. The data is plain props, so you feed it from your own query and save what onEventsChange hands back.
Week
Click an event for its card, drag it to another day or time, or switch to Work week.
November 2026
14 events this week
Month
Click an event for its card, drag it to another day, or click “N more” to see that day's events as a short list.
November 2026
36 events this month
Accessibility
- Every event is a button; a focused event moves with Alt + arrows, and its card closes with Escape.
- The card's calendar choices are a radio group; the “N more” list is a dialog of buttons, one per event.
- The header says what is in view as text (“14 events this week”), so a screen reader gets the summary without the grid.
Props (both blocks)
| Prop | Type | Default | Description |
|---|---|---|---|
| events | CalendarEventData[] | The events. Each one's meta.calendar is the id of one of the calendars. Defaults to a sample month. | |
| calendars | { id, name, color, group? }[] | The calendars an event can belong to: the choices on its card. | |
| defaultDate / now / today | Date | The first day shown, and a fixed "now" (week) or "today" (month) for documentation and tests. | |
| defaultView (week) | 'week' | 'work-week' | 'week' | Week or Work week in the header switch. |
| onEventsChange | (events) => void | Called with the whole list after a move, a calendar change in the card, or a delete. | |
| onCreate | (start?) => void | New event, or an empty slot (week). | |
| height | number | string | 720 (week) / auto (month) | The height of the whole block. |
Copy the source
Blocks are composition examples, not configurable components. Rather than adding props for a layout they don't support, copy the file into your own project and edit it: change the columns, swap the sample data, delete the parts you don't need. Nothing here introduces a primitive you can't already import on its own.
Why it works this way
Why
- Every day carries a full-date aria-label, so a grid of numbers is still understandable to a screen reader.
- In range mode, clicking before the start swaps the endpoints, so people can't build an invalid range.
Don't
- Don't use it when a typed date is faster. Pair it with an Input.