Genesis
@beta

EventCalendar

A calendar of events in one of four layouts: - `month`: the month's whole weeks; - `weeks`: 1 to 4 weeks (`weeks`), the week `anchor` is in first; - `agenda`: the same weeks as a day-by-day list, made to print (one page, no controls); - `lanes`: one row per lane (person), a column per day. An event spanning days shows on each; all-day events sit above timed ones; an event's dots are its `colors`, else its lanes' colours, and its lanes are named for screen readers. Days are a grid with one tab stop: arrow keys move a day or a week, Home and End go to the week's ends, PageUp and PageDown move the window back or on (keeping the focused day's place), and Tab reaches the events. Each day is read with its date and how many events it has. ```tsx <EventCalendar layout="weeks" weeks={2} weekStartsOn={0} events={events} lanes={people} onSelect={open} /> ```

packages/ui/src/components/data/calendar/EventCalendar.tsx

Import
Subpath export: @marktiderman/genesis-ui/data
import { EventCalendar } from "@marktiderman/genesis-ui/data";
Components
Auto-generated from TypeScript source via react-docgen-typescript.

EventCalendar

A calendar of events in one of four layouts: - `month`: the month's whole weeks; - `weeks`: 1 to 4 weeks (`weeks`), the week `anchor` is in first; - `agenda`: the same weeks as a day-by-day list, made to print (one page, no controls); - `lanes`: one row per lane (person), a column per day. An event spanning days shows on each; all-day events sit above timed ones; an event's dots are its `colors`, else its lanes' colours, and its lanes are named for screen readers. Days are a grid with one tab stop: arrow keys move a day or a week, Home and End go to the week's ends, PageUp and PageDown move the window back or on (keeping the focused day's place), and Tab reaches the events. Each day is read with its date and how many events it has. ```tsx <EventCalendar layout="weeks" weeks={2} weekStartsOn={0} events={events} lanes={people} onSelect={open} /> ```

PropTypeDefaultDescription
events*readonly CalendarEvent<T>[]—
anchorstring—A day in the window shown (default today). With `onAnchorChange`, the calendar is controlled.
classNamestring—
colorLanesbooleanfalseGive each lane with no `color` of its own `laneColor(i)` by its place in the lanes: the chart colours first, then distinct ones past five, so every person has a dot. Default false (a lane with no colour has no dot).
hideNavigationbooleanfalseHide the arrows and Today (a printed sheet, an embedded week).
labelstring—The table's name for screen readers, e.g. "Family events".
lanesreadonly CalendarLane[]—For `lanes`, and the dots' colours and names. Lanes an event names that aren't here are added.
layoutenum—Default `month`.
loadingbooleanfalseThe events are still loading: the calendar is `aria-busy` and never says "Nothing scheduled".
localestring—BCP 47 locale for dates and times. Default the runtime's.
noticeReactNode—Above the calendar: a cap notice, an error.
onAnchorChange((anchor: string) => void)—
onSelect((event: CalendarEvent<T>) => void)—An event was clicked or chosen from the keyboard. Without it, events aren't buttons.
showEmptyDaysbooleanfalseThe agenda shows days with nothing on them too. Default false.
testIDstringevent-calendarRoot test id; parts get `-item`, `-day`. Default `event-calendar`.
timeZonestring—The clock days are counted on. Default the device's.
toolbarReactNode—Beside the arrows: a layout switch, a filter. Hidden when printing.
weeksenum2Weeks a `weeks`, `agenda` or `lanes` layout shows, 1 to 4. Default 2.
weekStartsOnenum10 Sunday or 1 Monday (default).
Storybook
Storybook hosts the canonical visual reference with controls for every variant.