Components · Data Display
Event Calendar
A month or week grid of events. Display only: your app owns the events and what a click does.
import { EventCalendar } from '@nexub/react';Playground
Props
November 2026
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
<EventCalendar events={events} onEventClick={(e) => setPicked(e.title)} onDayClick={(d) => setPicked(d.toDateString())} />Examples
Team calendar
Day and agenda views
`views` adds Day (an hour grid with a "now" line) and Agenda (the month as a list) to the switcher.
Move, add and act on events
Drag an event, or press Alt+Arrow on it, to move it; a "+" per day, a menu per event and a legend.
States
November 2026
November 2026 Sun Mon Tue Wed Thu Fri Sat defaultNovember 2026
November 2026 Sun Mon Tue Wed Thu Fri Sat loading
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| eventsrequired | CalendarEvent[] | — | { id, title, start, end?, allDay?, tone? }. Events spanning days show on each day; tone is primary, success, warning, error or info. |
| date | Date | — | Any day in the shown month or week; Today and the arrows change it. |
| defaultDate | Date | — | Any day in the shown month or week; Today and the arrows change it. |
| onDateChange | ((date: Date) => void) | — | Any day in the shown month or week; Today and the arrows change it. |
| view | 'month' | 'week' | 'day' | 'agenda' | — | Week shows every event; month shows maxEventsPerDay then "N more". |
| defaultView | 'month' | 'week' | 'day' | 'agenda' | 'month' | Week shows every event; month shows maxEventsPerDay then "N more". |
| onViewChange | ((view: EventCalendarView) => void) | — | Week shows every event; month shows maxEventsPerDay then "N more". |
| onEventClick | ((event: CalendarEvent) => void) | — | Makes events buttons. |
| onDayClick | ((date: Date) => void) | — | Makes day numbers and "N more" buttons, for example to open the day. |
| maxEventsPerDay | number | 3 | Month view only. |
| weekStartsOn | 0 | 1 | 2 | 3 | 4 | 5 | 6 | — | Defaults to the locale’s first day (Monday for en-GB, Sunday for en-US). |
| onEventMove | ((event: CalendarEvent, range: { start: Date; end?: Date; }) => void) | — | 11.4. Makes events movable: drag one to another day (month, week) or time (day view, 15-minute steps), or press Alt+Arrow on it, pick with the arrows and press Enter (Escape cancels). The duration is kept. Events with editable: false stay put. |
| renderDayAction | ((date: Date) => React.ReactNode) | — | 11.4. A per-day slot, e.g. a small add button: in each day’s header (month, week), above the day view and beside each agenda day. |
| eventActions | ((event: CalendarEvent) => React.ReactNode) | — | 11.4. Controls for one event, e.g. a menu: beside it in day and agenda views, over its end on hover or focus in month and week cells (always shown on touch screens). |
| legend | EventCalendarLegendItem[] | — | 11.4. A row under the toolbar naming what each tone means. Colour is never the only signal: titles still say what an event is. |
| className | string | — | |
| emptyState | React.ReactNode | — | Shown under the grid when no event falls in the visible range (the month, week or day; agenda covers the month). The grid stays, and an empty range is normal, so there is no default. |
| errorState | React.ReactNode | — | Shown in place of the data when a load failed, for example an ErrorState with a retry action. Wins over loading and empty. |
| loading | boolean | — | Shows a skeleton in place of the data and sets aria-busy. |
| now | Date | new Date() | The current time: marks today and draws the "now" line in day view. Pass a fixed date in tests and screenshots. |
| views | EventCalendarView[] | ['month', 'week'] | Views offered in the switcher. 'day' (an hour grid for one day) and 'agenda' (the month's events as a list) are opt-in; the current view is always offered. |
Accessibility
Keyboard
- Alt + Arrow keys
With `onEventMove`, on an event: starts a move and takes the first step.
- Arrow keys
While moving: left and right a day; up and down a week, or 15 minutes in day view.
- Enter / Escape
Drops the event there, or cancels the move.
Notes
A table with weekday column headers; today has `aria-current="date"` and each day reads its full date.
The title is a polite live region, so Today and the arrows announce the new month or week.
Movable events describe the keyboard move (Alt+Arrow, then arrows, Enter or Escape); each step and the drop are announced in a polite live region.