CalendarProvider component wraps your calendar components and provides shared state management through React Context. It handles date selection, month changes, and coordinates updates between multiple calendar components like ExpandableCalendar, WeekCalendar, and AgendaList.
Import
Basic usage
Props
Initial date in βyyyy-MM-ddβ format. This is the starting date for the calendar.
Callback fired when the selected date changes. Receives the new date string and the source of the update.
Callback fired when the visible month changes. Receives date data object and the source of the update.
Theme object to override specific styles for calendar components. See the Theme documentation for all available options.
Custom style for the calendar container element.
Array of navigation types for which to disable automatic day selection. This allows users to scroll through months without changing the selected date.Available options:
'listDrag'- When scrolling the agenda list'pageScroll'- When scrolling between months'weekScroll'- When scrolling between weeks'arrowPress'- When pressing month arrows'weekArrowPress'- When pressing week arrows'todayPress'- When pressing the today button
Whether to show the floating βTodayβ button that jumps to the current date.
Bottom margin for the today button positioning in pixels.
Custom style object for the today button.
Opacity value (0-1) for the today button when itβs disabled (already showing today).
Number of days to display in timeline calendar mode. Used with Timeline and WeekCalendar components.
Left inset width for the timeline calendar (sidebar width) in pixels.
Update sources
TheonDateChanged and onMonthChange callbacks receive an updateSource parameter that indicates what triggered the update:
Initial calendar setup
Date prop changed from parent
Today button was pressed
A day was pressed in the calendar
Month arrow was pressed
Week arrow was pressed
Agenda list was scrolled
Calendar month was scrolled
Week calendar was scrolled
Advanced example
Related
- CalendarContext - Access context values in child components
- ExpandableCalendar - Expandable calendar component
- WeekCalendar - Week view calendar
- Timeline - Timeline view for events