Calendar
ProAn event calendar with month, week, day, agenda, resource schedule and timeline views, in any time zone. Not an M3 component (@windmorph/react-pro).
import { Calendar, CalendarToolbar, CalendarMonthView, CalendarTimeGridView, CalendarAgendaView, CalendarTimelineView, CalendarEvent, useCalendarState } from '@windmorph/react-pro/calendar';Part of Windmorph Pro, paid components on the free core, not on sale yet. See the Pro guide for what it includes and to register interest.
Props
Calendar 45 props
The events: pass each occurrence, since recurrence is the app's.
Replaces the toolbar, or removes it with
false.Shows a progress bar over the calendar.
Shown in the agenda when the period has no events.
The calendar's own density.
Ref to the outermost element.
The outermost element's id.
The resources for the schedule and timeline views.
The view (controlled). One of
views; any other shows the last view offered.defaultViewtype"month" | "week" | "day" | "agenda" | "resource-schedule" | "resource-timeline"default"month"The view at first.
The date shown (controlled).
The date at first.
The views offered; the resource views are used only when listed.
The display zone. Required for server rendering.
The moment "today" is worked out from at first, so the server and browser agree.
The week's first day.
A non-Gregorian calendar to display, as
buddhistorpersian.A slot's length in minutes.
The hours shown in the time views.
The open hours, shaded in the time views.
Spans shown as blocked, with a pattern as well as a tint.
What a timeline column covers.
How many days the resource schedule shows.
How many days the agenda shows.
How many bars a month cell shows before "+N more".
Replaces icons.
Replaces an event’s content.
Replaces a day’s header.
Adds content to a cell.
Replaces a resource’s name.
Events
Called when the view changes.
Called when the date changes.
A range was chosen. May return
false, an adjusted range, or a promise of either.onEventMovetype((change: CalendarEventChange<Data>) => CalendarChangeAnswer<CalendarEventChange<Data>>)An event moved. May return
false, an adjusted change, or a promise of either.onEventResizetype((change: CalendarEventChange<Data>) => CalendarChangeAnswer<CalendarEventChange<Data>>)An event's length changed. May return
false, an adjusted change, or a promise of either.An event was activated.
"+N more" was pressed.
Text
Words it shows or announces. A
LabelsProvidersets them for the whole app.The Today button.
Names the Previous button.
Names the Next button.
The view choice.
labels.viewstypeRecord<CalendarView, string>default"Month", "Week", "Day", "Agenda", "Schedule", "Timeline"Each view’s name.
The all-day row and an all-day event’s time.
Names the column of times.
The timeline’s first column.
Names the progress bar.
The empty agenda’s title.
The “+N more” button.
Names an event’s touch menu.
The menu item that moves it earlier.
The menu item that moves it later.
The menu item that lengthens it.
The menu item that shortens it.
labels.celltype(when: string, resource: string | undefined, events: number) => stringdefaultworded from its arguments, in EnglishNames a cell.
labels.eventtype(parts: { title: string; time: string; duration: string; resource: string | undefined; status: string | undefined; }) => stringdefaultits parts, joined with commasNames an event, from its parts.
An event’s length, in its name.
Announced when the period changes.
Announced when an event is picked up.
Announced when an event moves.
Announced when an event’s length changes.
Announced as a range grows.
Announced when a range is chosen.
Announced when a change isn’t accepted.
Announced when an operation is cancelled.
One of
aria-labeloraria-labelledbyis required.One of
aria-labeloraria-labelledbyis required.The id of an element that describes it.
The id of an element with more detail about it.
Classes for the outermost element. Wins over the defaults via
cn().Classes for each part.
The button for the previous period.
The button for the next period.
An event’s status.
The handle that changes an event’s length.
The touch menu on an event.
Each row of the grid.
The day heading in the agenda.
A resource’s name in the timeline.
The outermost element.
The toolbar.
The period’s title.
The Today button.
The view choice.
The area that scrolls.
The
gridelement.The header row.
Each column header.
A resource’s column header.
The all-day row.
The column of times.
Each time slot.
Each date cell.
A month cell’s number.
Each event.
An event’s title.
An event’s time.
The “+N more” button.
The current-time line.
A blocked cell.
A cell within open hours.
The cell an event would land in.
The cells of a range being selected.
A day of the agenda.
A row of the agenda.
The progress bar.
The empty agenda.
The polite announcement region.
Inline styles for the outermost element.
Also accepts the root element's HTML attributes (id, data-*, event handlers).
CalendarToolbar 7 props
What
useCalendarStatereturned.The views offered.
Ref to the toolbar.
The toolbar's id.
Classes for each part.
The button for the previous period.
The button for the next period.
An event’s status.
The handle that changes an event’s length.
The touch menu on an event.
Each row of the grid.
The day heading in the agenda.
A resource’s name in the timeline.
The outermost element.
The toolbar.
The period’s title.
The Today button.
The view choice.
The area that scrolls.
The
gridelement.The header row.
Each column header.
A resource’s column header.
The all-day row.
The column of times.
Each time slot.
Each date cell.
A month cell’s number.
Each event.
An event’s title.
An event’s time.
The “+N more” button.
The current-time line.
A blocked cell.
A cell within open hours.
The cell an event would land in.
The cells of a range being selected.
A day of the agenda.
A row of the agenda.
The progress bar.
The empty agenda.
The polite announcement region.
Classes for the toolbar. Wins over the defaults via
cn().Inline styles for the toolbar.
CalendarMonthView 10 props
What
useCalendarStatereturned.Ref to the view's outermost element.
The view's outermost element's id.
Text
One of
aria-labeloraria-labelledbyis required.One of
aria-labeloraria-labelledbyis required.The id of an element that describes it.
The id of an element with more detail about it.
Classes for each part.
The button for the previous period.
The button for the next period.
An event’s status.
The handle that changes an event’s length.
The touch menu on an event.
Each row of the grid.
The day heading in the agenda.
A resource’s name in the timeline.
The outermost element.
The toolbar.
The period’s title.
The Today button.
The view choice.
The area that scrolls.
The
gridelement.The header row.
Each column header.
A resource’s column header.
The all-day row.
The column of times.
Each time slot.
Each date cell.
A month cell’s number.
Each event.
An event’s title.
An event’s time.
The “+N more” button.
The current-time line.
A blocked cell.
A cell within open hours.
The cell an event would land in.
The cells of a range being selected.
A day of the agenda.
A row of the agenda.
The progress bar.
The empty agenda.
The polite announcement region.
Classes for the view's outermost element. Wins over the defaults via
cn().Inline styles for the view's outermost element.
CalendarTimeGridView 10 props
What
useCalendarStatereturned.Ref to the view's outermost element.
The view's outermost element's id.
Text
One of
aria-labeloraria-labelledbyis required.One of
aria-labeloraria-labelledbyis required.The id of an element that describes it.
The id of an element with more detail about it.
Classes for each part.
The button for the previous period.
The button for the next period.
An event’s status.
The handle that changes an event’s length.
The touch menu on an event.
Each row of the grid.
The day heading in the agenda.
A resource’s name in the timeline.
The outermost element.
The toolbar.
The period’s title.
The Today button.
The view choice.
The area that scrolls.
The
gridelement.The header row.
Each column header.
A resource’s column header.
The all-day row.
The column of times.
Each time slot.
Each date cell.
A month cell’s number.
Each event.
An event’s title.
An event’s time.
The “+N more” button.
The current-time line.
A blocked cell.
A cell within open hours.
The cell an event would land in.
The cells of a range being selected.
A day of the agenda.
A row of the agenda.
The progress bar.
The empty agenda.
The polite announcement region.
Classes for the view's outermost element. Wins over the defaults via
cn().Inline styles for the view's outermost element.
CalendarAgendaView 11 props
What
useCalendarStatereturned.Ref to the view's outermost element.
The view's outermost element's id.
Shown when the period has no events.
Text
One of
aria-labeloraria-labelledbyis required.One of
aria-labeloraria-labelledbyis required.The id of an element that describes it.
The id of an element with more detail about it.
Classes for each part.
The button for the previous period.
The button for the next period.
An event’s status.
The handle that changes an event’s length.
The touch menu on an event.
Each row of the grid.
The day heading in the agenda.
A resource’s name in the timeline.
The outermost element.
The toolbar.
The period’s title.
The Today button.
The view choice.
The area that scrolls.
The
gridelement.The header row.
Each column header.
A resource’s column header.
The all-day row.
The column of times.
Each time slot.
Each date cell.
A month cell’s number.
Each event.
An event’s title.
An event’s time.
The “+N more” button.
The current-time line.
A blocked cell.
A cell within open hours.
The cell an event would land in.
The cells of a range being selected.
A day of the agenda.
A row of the agenda.
The progress bar.
The empty agenda.
The polite announcement region.
Classes for the view's outermost element. Wins over the defaults via
cn().Inline styles for the view's outermost element.
CalendarTimelineView 10 props
What
useCalendarStatereturned.Ref to the view's outermost element.
The view's outermost element's id.
Text
One of
aria-labeloraria-labelledbyis required.One of
aria-labeloraria-labelledbyis required.The id of an element that describes it.
The id of an element with more detail about it.
Classes for each part.
The button for the previous period.
The button for the next period.
An event’s status.
The handle that changes an event’s length.
The touch menu on an event.
Each row of the grid.
The day heading in the agenda.
A resource’s name in the timeline.
The outermost element.
The toolbar.
The period’s title.
The Today button.
The view choice.
The area that scrolls.
The
gridelement.The header row.
Each column header.
A resource’s column header.
The all-day row.
The column of times.
Each time slot.
Each date cell.
A month cell’s number.
Each event.
An event’s title.
An event’s time.
The “+N more” button.
The current-time line.
A blocked cell.
A cell within open hours.
The cell an event would land in.
The cells of a range being selected.
A day of the agenda.
A row of the agenda.
The progress bar.
The empty agenda.
The polite announcement region.
Classes for the view's outermost element. Wins over the defaults via
cn().Inline styles for the view's outermost element.
CalendarEvent 10 props
What
useCalendarStatereturned.The event to show.
A one-line bar, as in a month cell.
How long one step of the touch menu moves it, in minutes, or a day when left out.
The operation under way on it.
Ref to the event.
The event's element id.
Classes for the event. Wins over the defaults via
cn().Classes for each part.
The button for the previous period.
The button for the next period.
An event’s status.
The handle that changes an event’s length.
The touch menu on an event.
Each row of the grid.
The day heading in the agenda.
A resource’s name in the timeline.
The outermost element.
The toolbar.
The period’s title.
The Today button.
The view choice.
The area that scrolls.
The
gridelement.The header row.
Each column header.
A resource’s column header.
The all-day row.
The column of times.
Each time slot.
Each date cell.
A month cell’s number.
Each event.
An event’s title.
An event’s time.
The “+N more” button.
The current-time line.
A blocked cell.
A cell within open hours.
The cell an event would land in.
The cells of a range being selected.
A day of the agenda.
A row of the agenda.
The progress bar.
The empty agenda.
The polite announcement region.
Inline styles for the event; a view places it with these.
Types
CalendarEventInput 10 fields
An event. Recurrence is the app's: pass each occurrence.
Unique among the events.
With
allDay, a day; otherwise a moment.With
allDay, the last day (inclusive); otherwise a moment.Whether it covers whole days.
The resources it belongs to.
Its semantic role.
A word for its state, always shown as text beside any colour.
Whether it can be moved and resized.
The app's own data.
CalendarEntry 12 fields
An event as the calendar reads it: absolute, in the display zone.
The event’s
id.The event’s title.
When it starts, in the display zone.
Exclusive.
Whether it covers whole days.
The first day it touches.
Inclusive.
The resources it belongs to.
Its semantic role.
Its status, in words.
Whether it can be moved and resized.
The event the app passed.
CalendarResource 2 fields
A resource: a person, room or machine.
Unique among the resources.
Its name.
CalendarBusinessHours 3 fields
Hours open for work. days are 0 (the week's first) to 6, or all when left out.
0 (the week’s first) to 6.
First hour, 0 to 24.
Last hour, 0 to 24.
CalendarBlockedRange 4 fields
A span of time marked as blocked.
Where it starts.
Where it ends.
Applies only to these resources; every one when left out.
Whether it can still be chosen or dropped on.
CalendarRange 4 fields
A selected span, as onSelectRange reports it.
Where it starts.
Exclusive.
Whether it’s whole days.
The resource it’s for, in a resource view.
CalendarEventChange 5 fields
An event's new place, as onEventMove and onEventResize report it.
The event the app passed.
Its new start.
Exclusive.
For an all-day event, the first and last day.
Its resources after the change.
CalendarCellInfo 14 fields
One date cell, handed to renderCell.
Its row.
Its column.
Where it starts.
Exclusive.
Whether it’s a whole day.
Its day.
Its resource, in a resource view.
Its accessible name.
A wall-clock time this day doesn't have, skipped by a clock change.
Whether a blocked range meets it.
Whether it can be chosen or dropped on.
Whether it’s today.
Whether it falls outside the month shown.
Whether it’s within open hours.
Hooks
useCalendarState
A calendar's state, for composing its views differently from Calendar. Not an M3 component (Windmorph Pro, docs/plans/calendar.md).
The events: pass each occurrence, since recurrence is the app's.
The resources for the schedule and timeline views.
The view (controlled). One of
views; any other shows the last view offered.The view at first.
Called when the view changes.
The date shown (controlled).
The date at first.
Called when the date changes.
The views offered; the resource views are used only when listed.
The display zone. Required for server rendering.
The moment "today" is worked out from at first, so the server and browser agree.
The week's first day.
A non-Gregorian calendar to display, as
buddhistorpersian.A slot's length in minutes.
The hours shown in the time views.
The open hours, shaded in the time views.
Spans shown as blocked, with a pattern as well as a tint.
What a timeline column covers.
How many days the resource schedule shows.
How many days the agenda shows.
How many bars a month cell shows before "+N more".
A range was chosen. May return
false, an adjusted range, or a promise of either.options.onEventMovetype(change: CalendarEventChange<Data>) => CalendarChangeAnswer<CalendarEventChange<Data>>An event moved. May return
false, an adjusted change, or a promise of either.options.onEventResizetype(change: CalendarEventChange<Data>) => CalendarChangeAnswer<CalendarEventChange<Data>>An event's length changed. May return
false, an adjusted change, or a promise of either.An event was activated.
"+N more" was pressed.
Words it shows or announces. A
LabelsProvidersets them for the whole app.Replaces icons.
Replaces an event’s content.
Replaces a day’s header.
Adds content to a cell.
Replaces a resource’s name.
Returns { view: CalendarView; setView: (value: React.SetStateAction<CalendarView>, ...args: any[]) => void; views: readonly CalendarView[]; date: CalendarDate; setDate: (next: CalendarDate) => void; previous: () => void; next: () => void; goToToday: () => void; title: string; timeZone: string; locale: string; firstDayOfWeek: FirstDayOfWeek | undefined; calendarId: string | undefined; entries: CalendarEntry<Data>[]; index: Map<string, CalendarEntry<Data>[]>; resources: readonly CalendarResource[]; slotDuration: number; visibleHours: readonly [number, number]; timelineUnit: CalendarTimelineUnit; scheduleDays: number; agendaDays: number; maxEventsPerDay: number; blockedAt: (start: ZonedDateTime, end: ZonedDateTime, resourceId: string | undefined) => { blocked: boolean; selectable: boolean; }; isBusiness: (day: CalendarDate, hour: number) => boolean; now: ZonedDateTime | null; today: CalendarDate | null; formatters: { dayNumber: DateFormatter; weekday: DateFormatter; weekdayDay: DateFormatter; longDay: DateFormatter; time: DateFormatter; dateTime: DateFormatter; month: DateFormatter; shortDay: DateFormatter; range: DateFormatter; }; asDate: (day: CalendarDate) => Date; labels: CalendarLabels & Partial<CalendarLabels>; icons: { previous: React.ReactElement<unknown, string | React.JSXElementConstructor<any>>; next: React.ReactElement<unknown, string | React.JSXElementConstructor<any>>; more: React.ReactElement<unknown, string | React.JSXElementConstructor<any>>; empty: React.ReactElement<unknown, string | React.JSXElementConstructor<any>>; }; announcement: string; announce: React.Dispatch<React.SetStateAction<string>>; onSelectRange: ((range: CalendarRange) => CalendarChangeAnswer<CalendarRange>) | undefined; onEventMove: ((change: CalendarEventChange<Data>) => CalendarChangeAnswer<CalendarEventChange<Data>>) | undefined; onEventResize: ((change: CalendarEventChange<Data>) => CalendarChangeAnswer<CalendarEventChange<Data>>) | undefined; onEventAction: ((event: CalendarEventInput<Data>) => void) | undefined; onMoreEvents: ((day: CalendarDate) => void) | undefined; renderEvent: ((event: CalendarEntry<Data>) => React.ReactNode) | undefined; renderDayHeader: ((day: CalendarDate) => React.ReactNode) | undefined; renderCell: ((cell: CalendarCellInfo) => React.ReactNode) | undefined; renderResource: ((resource: CalendarResource) => React.ReactNode) | undefined; entriesOn: (day: CalendarDate) => readonly CalendarEntry<Data>[]; }
iconstype{ previous: React.ReactElement<unknown, string | React.JSXElementConstructor<any>>; next: React.ReactElement<unknown, string | React.JSXElementConstructor<any>>; more: React.ReactElement<unknown, string | React.JSXElementConstructor<any>>; empty: React.ReactElement<unknown, string | React.JSXElementConstructor<any>>; }Required
Spec status
Not part of Material Design 3: a Windmorph Pro component, built on M3's colour roles, type scale, shapes and motion. Its variants and configurations each link to a live example.
Theming & tokens
Set the tokens below on the calendar or any ancestor. An event's color picks one of its role tokens. Style each part with classNames: root, toolbar, title, navigation, todayButton, viewSwitch, grid, header, headerCell, resourceHeader, allDayRow, timeGutter, slot, cell, dayNumber, event, eventTitle, eventTime, more, nowLine, blocked, businessHours, dragPreview, selectionRange, agendaGroup, agendaRow, loading, empty, liveRegion.
| Variable | Default | Paints |
|---|---|---|
--wm-calendar-surface-color | var(--md-sys-color-surface) | The calendar’s surface. |
--wm-calendar-outline-color | var(--md-sys-color-outline-variant) | The lines between cells. |
--wm-calendar-header-height | 48px | The header row’s height. |
--wm-calendar-header-text-color | var(--md-sys-color-on-surface-variant) | The header’s text. |
--wm-calendar-cell-min-height | 112px | A month cell’s least height. |
--wm-calendar-cell-padding | 4px | The space inside a cell. |
--wm-calendar-slot-height | 2rem | A time slot’s height at density 0; each density step takes 4px off. |
--wm-calendar-gutter-width | 72px | The width of the time gutter. |
--wm-calendar-resource-column-width | 160px | A resource’s column in the schedule. |
--wm-calendar-resource-row-height | 64px | A resource’s row in the timeline. |
--wm-calendar-timeline-column-width | 96px | A column of the timeline. |
--wm-calendar-today-color | var(--md-sys-color-primary) | The fill of today’s number. |
--wm-calendar-today-text-color | var(--md-sys-color-on-primary) | The text of today’s number. |
--wm-calendar-outside-month-color | var(--md-sys-color-on-surface-variant) | The number of a day outside the month. |
--wm-calendar-event-shape | var(--md-sys-shape-corner-small) | An event’s corners. |
--wm-calendar-event-padding | 4px | The space at an event’s sides. |
--wm-calendar-event-status-min-width | 4ch | The least an event’s status narrows to, in favour of its title. |
--wm-calendar-event-height | 1.5rem | The height of a bar in a month cell or the all-day row. |
--wm-calendar-event-primary-color | var(--md-sys-color-primary-container) | The fill of an event with the primary role. |
--wm-calendar-event-primary-text-color | var(--md-sys-color-on-primary-container) | The text of an event with the primary role. |
--wm-calendar-event-secondary-color | var(--md-sys-color-secondary-container) | The fill of an event with the secondary role. |
--wm-calendar-event-secondary-text-color | var(--md-sys-color-on-secondary-container) | The text of an event with the secondary role. |
--wm-calendar-event-tertiary-color | var(--md-sys-color-tertiary-container) | The fill of an event with the tertiary role. |
--wm-calendar-event-tertiary-text-color | var(--md-sys-color-on-tertiary-container) | The text of an event with the tertiary role. |
--wm-calendar-event-error-color | var(--md-sys-color-error-container) | The fill of an event with the error role. |
--wm-calendar-event-error-text-color | var(--md-sys-color-on-error-container) | The text of an event with the error role. |
--wm-calendar-event-neutral-color | var(--md-sys-color-surface-container-highest) | The fill of an event with the neutral role. |
--wm-calendar-event-neutral-text-color | var(--md-sys-color-on-surface) | The text of an event with the neutral role. |
--wm-calendar-selection-color | var(--md-sys-color-secondary-container) | A cell in the range being selected. |
--wm-calendar-drop-color | var(--md-sys-color-primary) | The outline of the cell an event would land in. |
--wm-calendar-now-line-color | var(--md-sys-color-error) | The current-time line. |
--wm-calendar-now-line-width | 2px | The current-time line’s thickness. |
--wm-calendar-business-hours-color | var(--md-sys-color-surface-container-low) | The tint of open hours. |
--wm-calendar-blocked-color | var(--md-sys-color-outline-variant) | The stripes of a blocked range. |
--wm-calendar-view-switch-width | 10rem | The view choice’s width. |
--wm-calendar-absent-opacity | 0.4 | A time slot that doesn’t exist on that day, as when the clocks change. |
--wm-calendar-drag-opacity | 0.6 | An event while it is dragged or resized. |
--wm-calendar-toolbar-gap | 8px | The space between the toolbar’s parts. |
--wm-calendar-settle-duration | var(--md-sys-motion-spring-effects-fast-duration) | How long an event takes to settle after a drag. |
--wm-calendar-settle-easing | var(--md-sys-motion-spring-effects-fast-easing) | The curve of an event settling after a drag. |
--wm-calendar-gutter-padding | 8px | The space at the end of the time gutter. |
--wm-calendar-resource-label-padding | 8px | The space at the sides of a resource’s name in the timeline. |
--wm-calendar-day-number-size | 24px | A month cell’s number. |
--wm-calendar-bar-top-inset | 28px | The space above the first bar in a month cell or the all-day row. |
--wm-calendar-bar-gap | 2px | The space between stacked bars. |
--wm-calendar-agenda-padding | 8px | The space inside an agenda day. |
--wm-calendar-agenda-gap | 4px | The space between an agenda day’s events. |
--wm-calendar-agenda-event-padding | 8px | The space above and below an agenda event. |
--wm-calendar-agenda-row-min-height | 48px | An agenda event’s least height. |
--wm-calendar-resize-handle-height | 6px | The height of an event’s resize handle. |
--wm-calendar-empty-padding | 32px | The space above and below the empty agenda. |