Forms
Calendar
The raw month grid behind Date picker and Date range picker. Reach for it directly only when you need the grid without a field.
Not documented yet
This component ships in the design system and is fully supported. What is missing is the guidance around it: when to reach for it, the do and don't, and the accessibility notes. Until that is written, Storybook is the reference for variants, props and live controls.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
mode | "single" | "multiple" | "range" | undefined | — | Enable the selection of a single day, multiple days, or a range of days. |
required | boolean | undefined | — | Whether the selection is required. |
className | string | undefined | — | Class name to add to the root element. |
classNames | (Partial<ClassNames> & Partial<DeprecatedUI<string>>) | undefined | — | Change the class names used by DayPicker. Use this prop when you need to change the default class names — for example, when importing the style via CSS modules or when using a CSS framework. |
modifiersClassNames | ModifiersClassNames | undefined | — | Change the class name for the day matching the `modifiers`. |
style | React.CSSProperties | undefined | — | Style to apply to the root element. |
styles | (Partial<Styles> & Partial<DeprecatedUI<React.CSSProperties>>) | undefined | — | Change the inline styles of the HTML elements. |
modifiersStyles | ModifiersStyles | undefined | — | Change the class name for the day matching the {@link modifiers}. |
id | string | undefined | — | A unique id to add to the root element. |
defaultMonth | Date | undefined | The current month | The initial month to show in the calendar. Use this prop to let DayPicker control the current month. If you need to set the month programmatically, use {@link month} and {@link onMonthChange}. |
month | Date | undefined | — | The month displayed in the calendar. As opposed to `defaultMonth`, use this prop with `onMonthChange` to change the month programmatically. |
numberOfMonths | number | undefined | 1 | The number of displayed months. |
startMonth | Date | undefined | — | The earliest month to start the month navigation. |
fromDatedeprecated | Date | undefined | — | — |
fromMonthdeprecated | Date | undefined | — | — |
fromYeardeprecated | number | undefined | — | — |
endMonth | Date | undefined | — | The latest month to end the month navigation. |
toDatedeprecated | Date | undefined | — | — |
toMonthdeprecated | Date | undefined | — | — |
toYeardeprecated | number | undefined | — | — |
pagedNavigation | boolean | undefined | — | Paginate the month navigation displaying the `numberOfMonths` at a time. |
reverseMonths | boolean | undefined | — | Render the months in reversed order (when {@link numberOfMonths} is set) to display the most recent month first. |
hideNavigation | boolean | undefined | — | Hide the navigation buttons. This prop won't disable the navigation: to disable the navigation, use {@link disableNavigation}. |
disableNavigation | boolean | undefined | — | Disable the navigation between months. This prop won't hide the navigation: to hide the navigation, use {@link hideNavigation}. |
captionLayout | "label" | "dropdown" | "dropdown-months" | "dropdown-years" | undefined | — | Show dropdowns to navigate between months or years. - `label`: Displays the month and year as a label. Default value. - `dropdown`: Displays dropdowns for both month and year navigation. - `dropdown-months`: Displays a dropdown only for the month navigation. - `dropdown-years`: Displays a dropdown only for the year navigation. **Note:** By default, showing the dropdown will set the {@link startMonth} to 100 years ago and {@link endMonth} to the end of the current year. You can override this behavior by explicitly setting `startMonth` and `endMonth`. |
reverseYears | boolean | undefined | — | Reverse the order of years in the dropdown when using `captionLayout="dropdown"` or `captionLayout="dropdown-years"`. |
navLayout | "around" | "after" | undefined | — | Adjust the positioning of the navigation buttons. - `around`: Displays the buttons on either side of the caption. - `after`: Displays the buttons after the caption. This ensures the tab order matches the visual order. If not set, the buttons default to being displayed after the caption, but the tab order may not align with the visual order. |
fixedWeeks | boolean | undefined | — | Display always 6 weeks per each month, regardless of the month’s number of weeks. Weeks will be filled with the days from the next month. |
hideWeekdays | boolean | undefined | — | Hide the row displaying the weekday row header. |
showOutsideDays | boolean | undefined | — | Show the outside days (days falling in the next or the previous month). **Note:** when a {@link broadcastCalendar} is set, this prop defaults to true. |
showWeekNumber | boolean | undefined | — | Show the week numbers column. Weeks are numbered according to the local week index. |
animate | boolean | undefined | — | Animate navigating between months. |
broadcastCalendar | boolean | undefined | — | Display the weeks in the month following the broadcast calendar. Setting this prop will ignore {@link weekStartsOn} (always Monday) and {@link showOutsideDays} will default to true. |
ISOWeek | boolean | undefined | — | Use ISO week dates instead of the locale setting. Setting this prop will ignore `weekStartsOn` and `firstWeekContainsDate`. |
timeZone | string | undefined | — | The time zone (IANA or UTC offset) to use in the calendar (experimental). See [Wikipedia](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) for the possible values. |
noonSafe | boolean | undefined | — | Keep calendar math at noon in the configured {@link timeZone} to avoid historical second-level offsets drifting dates across midnight. This prop sets the time of the dates to noon (12:00). |
components | Partial<CustomComponents> | undefined | — | Change the components used for rendering the calendar elements. |
footer | React.ReactNode | — | Add a footer to the calendar, acting as a live region. Use this prop to communicate the calendar's status to screen readers. Prefer strings over complex UI elements. |
autoFocus | boolean | undefined | — | When a selection mode is set, DayPicker will focus the first selected day (if set) or today's date (if not disabled). Use this prop when you need to focus DayPicker after a user action, for improved accessibility. |
initialFocusdeprecated | boolean | undefined | — | — |
disabled | Matcher | Matcher[] | undefined | — | Apply the `disabled` modifier to the matching days. Disabled days cannot be selected when in a selection mode is set. |
hidden | Matcher | Matcher[] | undefined | — | Apply the `hidden` modifier to the matching days. Will hide them from the calendar. |
today | Date | undefined | — | The today’s date. Default is the current date. This date will get the `today` modifier to style the day. |
modifiers | Record<string, Matcher | Matcher[] | undefined> | undefined | — | Add modifiers to the matching days. |
labels | Partial<Labels> | undefined | — | Labels creators to override the defaults. Use this prop to customize the aria-label attributes in DayPicker. |
formatters | Partial<Formatters> | undefined | — | Formatters used to format dates to strings. Use this prop to override the default functions. |
dir | string | undefined | — | The text direction of the calendar. Use `ltr` for left-to-right (default) or `rtl` for right-to-left. |
aria-label | string | undefined | — | The aria-label attribute to add to the container element. |
aria-labelledby | string | undefined | — | The aria-labelledby attribute to add to the container element. |
role | "application" | "dialog" | undefined | — | The role attribute to add to the container element. |
nonce | string | undefined | — | A cryptographic nonce ("number used once") which can be used by Content Security Policy for the inline `style` attributes. |
title | string | undefined | — | Add a `title` attribute to the container element. |
lang | string | undefined | — | Add the language tag to the container element. When omitted, DayPicker uses the active locale code (`locale.code`). Set this prop to override the language tag. |
locale | Partial<DayPickerLocale> | undefined | enUS - The English locale default of `date-fns`. | The locale object used to localize dates. Pass a locale from `react-day-picker/locale` to localize the calendar. |
numerals | Numerals | undefined | `latn` Latin (Western Arabic) | The numeral system to use when formatting dates. - `latn`: Latin (Western Arabic) - `arab`: Arabic-Indic - `arabext`: Eastern Arabic-Indic (Persian) - `deva`: Devanagari - `beng`: Bengali - `guru`: Gurmukhi - `gujr`: Gujarati - `orya`: Oriya - `tamldec`: Tamil - `telu`: Telugu - `knda`: Kannada - `mlym`: Malayalam |
weekStartsOn | 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined | — | The index of the first day of the week (0 - Sunday). Overrides the locale's default. |
firstWeekContainsDate | 1 | 4 | undefined | — | The day of January that is always in the first week of the year. |
useAdditionalWeekYearTokens | boolean | undefined | — | Enable `DD` and `DDDD` for week year tokens when formatting or parsing dates. |
useAdditionalDayOfYearTokens | boolean | undefined | — | Enable `YY` and `YYYY` for day of year tokens when formatting or parsing dates. |
onMonthChange | MonthChangeEventHandler | undefined | — | Event fired when the user navigates between months. |
onNextClick | MonthChangeEventHandler | undefined | — | Event handler when the next month button is clicked. |
onPrevClick | MonthChangeEventHandler | undefined | — | Event handler when the previous month button is clicked. |
onWeekNumberClickdeprecated | any | — | Event handler when a week number is clicked. |
onDayClick | DayEventHandler<React.MouseEvent<Element, MouseEvent>> | undefined | — | Event handler when a day is clicked. |
onDayFocus | DayEventHandler<React.FocusEvent<Element, Element>> | undefined | — | Event handler when a day is focused. |
onDayBlur | DayEventHandler<React.FocusEvent<Element, Element>> | undefined | — | Event handler when a day is blurred. |
onDayKeyDown | DayEventHandler<React.KeyboardEvent<Element>> | undefined | — | Event handler when a key is pressed on a day. |
onDayMouseEnter | DayEventHandler<React.MouseEvent<Element, MouseEvent>> | undefined | — | Event handler when the mouse enters a day. |
onDayMouseLeave | DayEventHandler<React.MouseEvent<Element, MouseEvent>> | undefined | — | Event handler when the mouse leaves a day. |
dateLib | Partial<DateLib> | undefined | — | Replace the default date library with a custom one. Experimental: not guaranteed to be stable (may not respect semver). |
onDayKeyUpdeprecated | DayEventHandler<React.KeyboardEvent<Element>> | undefined | — | — |
onDayKeyPressdeprecated | DayEventHandler<React.KeyboardEvent<Element>> | undefined | — | — |
onDayPointerEnterdeprecated | DayEventHandler<React.PointerEvent<Element>> | undefined | — | — |
onDayPointerLeavedeprecated | DayEventHandler<React.PointerEvent<Element>> | undefined | — | — |
onDayTouchCanceldeprecated | DayEventHandler<React.TouchEvent<Element>> | undefined | — | — |
onDayTouchEnddeprecated | DayEventHandler<React.TouchEvent<Element>> | undefined | — | — |
onDayTouchMovedeprecated | DayEventHandler<React.TouchEvent<Element>> | undefined | — | — |
onDayTouchStartdeprecated | DayEventHandler<React.TouchEvent<Element>> | undefined | — | — |