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
@marktiderman/genesis-ui/dataimport { EventCalendar } from "@marktiderman/genesis-ui/data";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} /> ```
| Prop | Type | Default | Description |
|---|---|---|---|
| events* | readonly CalendarEvent<T>[] | — | |
| anchor | string | — | A day in the window shown (default today). With `onAnchorChange`, the calendar is controlled. |
| className | string | — | |
| colorLanes | boolean | false | Give 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). |
| hideNavigation | boolean | false | Hide the arrows and Today (a printed sheet, an embedded week). |
| label | string | — | The table's name for screen readers, e.g. "Family events". |
| lanes | readonly CalendarLane[] | — | For `lanes`, and the dots' colours and names. Lanes an event names that aren't here are added. |
| layout | enum | — | Default `month`. |
| loading | boolean | false | The events are still loading: the calendar is `aria-busy` and never says "Nothing scheduled". |
| locale | string | — | BCP 47 locale for dates and times. Default the runtime's. |
| notice | ReactNode | — | 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. |
| showEmptyDays | boolean | false | The agenda shows days with nothing on them too. Default false. |
| testID | string | event-calendar | Root test id; parts get `-item`, `-day`. Default `event-calendar`. |
| timeZone | string | — | The clock days are counted on. Default the device's. |
| toolbar | ReactNode | — | Beside the arrows: a layout switch, a filter. Hidden when printing. |
| weeks | enum | 2 | Weeks a `weeks`, `agenda` or `lanes` layout shows, 1 to 4. Default 2. |
| weekStartsOn | enum | 1 | 0 Sunday or 1 Monday (default). |