@dax-ui/calendar
v0.8.0
Published
dax-ui Calendar: month, week and day views with category filters, search and an agenda panel
Maintainers
Readme
@dax-ui/calendar
TODO: one or two sentences on what this component is for.
Installation
pnpm add @dax-ui/calendarMUI and Emotion are included; the app only needs React 18 or 19.
One-time setup per app (skip if the app already uses dax-ui): install
@dax-ui/theme and wrap the app in its UIProvider.
pnpm add @dax-ui/themeUsage
import { Calendar } from '@dax-ui/calendar';
<Calendar />Props
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| agendaBreakpoint | number | 960 | Calendar width in px under which the agenda no longer fits beside the grid (see agendaOnSmallScreens). Measured on the calendar itself, not the window. |
| agendaEmptyState | ReactNode | | Shown in the agenda when the period has no events. |
| agendaOnSmallScreens | "stack" \| "hide" | stack | When the calendar is narrower than agendaBreakpoint: stack puts the agenda below the grid, hide hides it. |
| agendaShowDateTime | boolean | true | Adds Date and Time rows to each agenda card, before the event's meta. |
| agendaSubtitle | ReactNode | | Line under the agenda heading. Defaults to "22 scheduled items". |
| agendaTitle | ReactNode | | Agenda heading. Defaults to the period, e.g. "November 2026". |
| agendaWidth | number | 400 | Width of the agenda panel in px, when it's beside the grid. |
| categories | CalendarCategory[] | [] | Event categories: their colors, and one filter chip each. |
| className | string | | Class name of the root element. |
| colors | Partial<CalendarColors> | | Overrides any of the colors, e.g. { accent: '#4f46e5' }. Unset keys keep the defaults. |
| date | Date | | The current date: which month, week or day is shown. Pair with onDateChange to control it. |
| defaultDate | Date | | Initial date when date isn't controlled. Defaults to today. |
| defaultEventDuration | number | 30 | Length in minutes of timed events that have no end. |
| defaultSearch | string | `` | Initial search text when search isn't controlled. |
| defaultSelectedCategories | string[] | [] | Initially selected category ids when selectedCategories isn't controlled. |
| defaultShowAgenda | boolean | true | Initial agenda visibility when showAgenda isn't controlled. |
| defaultView | "month" \| "week" \| "day" | month | Initial view when view isn't controlled. |
| drillDownView | CalendarView \| null | day | View opened by clicking a date number (month) or a day header (week) when onDateClick isn't set. null makes them plain text. |
| events | CalendarEvent<TData>[] | [] | The events to show. |
| fixedWeeks | boolean | true | Always shows six weeks in the month view, so its height doesn't change between months. |
| formats | Partial<CalendarFormats> | | Overrides any of the date-fns format patterns. |
| getEventLabel | ((event: CalendarEvent<TData>) => string) | | Accessible name of each event button. Defaults to "Title, Wednesday Nov 4, 2026, 9:30 AM". |
| height | string \| number | | Height of the whole calendar, e.g. 800 or '100vh'. The grid stretches to fill it. Without it, month rows are at least 112px and the week/day grid is 640px tall. |
| hourHeight | number | 48 | Height of one hour in the week and day views, in px. |
| hourRange | [number, number] | [0, 24] | Hours shown in the week and day views, [first, last), e.g. [7, 20] for 7 AM to 8 PM. |
| labels | Partial<CalendarLabels> | | Overrides any of the texts, e.g. for translation. |
| loading | boolean | false | Shows placeholders in the grid and the agenda while events load. |
| locale | Locale | | date-fns locale for month and weekday names, e.g. import { fr } from 'date-fns/locale'. |
| maxEventsPerDay | number | 2 | Events shown per day in the month view before a "+N more" link. |
| now | Date | | The current date and time (today's highlight, the now line, the Today button). Defaults to the clock. |
| onDateChange | ((date: Date) => void) | | Called when the user navigates: arrows, Today, the picker, or clicking a date. |
| onDateClick | ((date: Date, domEvent: MouseEvent<HTMLElement, MouseEvent>) => void) | | Called when an empty part of a day is clicked in the month view, or a date number / week-view day header is clicked. Without it, date numbers open drillDownView. |
| onEventClick | ((event: CalendarEvent<TData>, domEvent: MouseEvent<HTMLElement, MouseEvent>) => void) | | Called when an event is clicked, anywhere it's shown. |
| onRangeChange | ((range: CalendarRange) => void) | | Called with the visible range when the calendar mounts and whenever it changes, to load events for it. |
| onSearchChange | ((search: string) => void) | | Called on every change of the search text. |
| onSelectedCategoriesChange | ((categoryIds: string[]) => void) | | Called when a filter chip is toggled. |
| onShowAgendaChange | ((show: boolean) => void) | | Called when the agenda toggle is clicked. |
| onSlotClick | ((slot: CalendarSlot, domEvent: MouseEvent<HTMLElement, MouseEvent>) => void) | | Called when an empty time slot (or all-day cell) is clicked in the week or day view. |
| onViewChange | ((view: CalendarView) => void) | | Called when the view changes (switcher, or clicking a date). |
| renderAgendaItem | ((event: CalendarEvent<TData>, context: CalendarAgendaItemContext) => ReactNode) | | Replaces the content of each agenda card. |
| renderEvent | CalendarEventRenderer<TData> \| Partial<Record<CalendarView, CalendarEventRenderer<TData>>> | | Replaces the content drawn inside events: one function for every view, or one per view, e.g. { month: renderPill }. The calendar keeps the button, its click and its accessible name. |
| renderToolbar | ((api: CalendarToolbarApi) => ReactNode) | | Replaces the whole toolbar. Receives the calendar's state and actions. |
| scrollToHour | number | 8 | Hour the week and day views scroll to when shown. |
| search | string | | The search text. Pair with onSearchChange to control it. |
| searchMode | "client" \| "server" | client | client: the calendar filters events by title, category, badges and meta values. server: it doesn't filter; load matching events yourself from onSearchChange. |
| searchPredicate | ((event: CalendarEvent<TData>, query: string) => boolean) | | Custom client-side search match. Receives the event and the trimmed, lower-cased query. |
| selectedCategories | string[] | | Selected category ids; empty means all. Pair with onSelectedCategoriesChange to control it. |
| showAgenda | boolean | | Whether the agenda panel is shown. Pair with onShowAgendaChange to control it. |
| showAgendaToggle | boolean | false | Adds a square button at the right end of the toolbar that shows and hides the agenda. |
| showCategoryCounts | boolean | true | Shows the number of events in the period on each chip. |
| showCategoryFilters | boolean | true | Shows the category filter chips (when there are categories). |
| showDatePicker | boolean | true | Shows the month-year picker button. |
| showEventTimeInMonth | boolean | false | Shows the start time before timed events' titles in the month view. |
| showNavigation | boolean | true | Shows the previous / next arrows. |
| showNowIndicator | boolean | true | Shows the current-time line on today in the week and day views. |
| showOutsideDays | boolean | true | Shows the dates of the previous and next month in the month view's first and last week. |
| showSearch | boolean | true | Shows the search input. |
| showTodayButton | boolean | true | Shows the Today button. |
| showToolbar | boolean | true | Shows the toolbar row. |
| showViewSwitcher | boolean | true | Shows the Month / Week / Day switcher. |
| slotDuration | number | 30 | Length of a clicked slot in minutes (onSlotClick). |
| sx | SxProps<Theme> | | Style overrides for the root element. |
| timeFormat | "12h" \| "24h" | 12h | 12h ("9:30 AM") or 24h ("09:30") times. |
| toolbarActions | ReactNode | | Content at the right end of the toolbar, e.g. an "Add New" MenuButton. |
| view | "month" \| "week" \| "day" | | The current view. Pair with onViewChange to control it. |
| views | CalendarView[] | ['month', 'week', 'day'] | Views offered by the view switcher, in order. |
| weekStartsOn | 0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 | 0 | First day of the week. |
Run pnpm docs to fill in the table above from the JSDoc in src/Calendar.types.ts.
