FormsInteractive playground
Calendar
Date selection in a calendar view.
Preparing the playground…
Text and Markdown example
Calendar · Example
1function Example() {
2 const [date, setDate] = useState<Date | undefined>(new Date(2026, 8, 9));
3 return <Calendar mode="single" selected={date} onSelect={setDate} defaultMonth={new Date(2026, 8, 1)} />;
4}How to use it
Based on DayPicker. Combine mode="single" with selected and onSelect; use mode="range" for date ranges.
Import
React / Next.js
1import { Calendar } from "@kivora/nextjs";Interactive examples run inside a component with "use client". The playground's Copy button includes the imports needed for the current example.
API reference 0.2.0
Types from the installed published version, including component properties and common HTML attributes. “Optional” does not imply a default value; omitting a property lets the component decide.
| Property | Type | Description |
|---|---|---|
selectedRequired | Date | Date[] | Date[] | DateRange | DateRange | Selected date or dates. |
animate | boolean | Enable or disable animation. |
aria-label | string | Accessible name of the control. |
aria-labelledby | string | The aria-labelledby attribute to add to the container element. |
autoFocus | boolean | 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. |
broadcastCalendar | boolean | 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. |
captionLayout | "label" | "dropdown" | "dropdown-months" | "dropdown-years" | 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`. |
className | string | Additional CSS classes to customize the element. |
classNames | Partial<ClassNames> | 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. |
components | Partial<CustomComponents> | Change the components used for rendering the calendar elements. |
dateLib | Partial<DateLib> | Replace the default date library with a custom one. Experimental: not guaranteed to be stable (may not respect semver). |
defaultMonth | Date | 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}. |
dir | string | Interface reading direction. |
disabled | Matcher | Matcher[] | Disable interaction with the control. |
disableNavigation | boolean | Disable the navigation between months. This prop won't hide the navigation: to hide the navigation, use {@link hideNavigation}. |
endMonth | Date | The latest month to end the month navigation. |
excludeDisabled | boolean | When `true`, the range will reset when including a disabled day. |
firstWeekContainsDate | 1 | 4 | The day of January that is always in the first week of the year. |
fixedWeeks | boolean | 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. |
footer | 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. |
formatters | Partial<Formatters> | Formatters used to format dates to strings. Use this prop to override the default functions. |
fullWidth | boolean | Configures fullWidth. The type describes the supported values and structure. |
hidden | Matcher | Matcher[] | Apply the `hidden` modifier to the matching days. Will hide them from the calendar. |
hideNavigation | boolean | Hide the navigation buttons. This prop won't disable the navigation: to disable the navigation, use {@link disableNavigation}. |
hideWeekdays | boolean | Hide the row displaying the weekday row header. |
id | string | Element identifier; associates labels and descriptions. |
ISOWeek | boolean | Use ISO week dates instead of the locale setting. Setting this prop will ignore `weekStartsOn` and `firstWeekContainsDate`. |
labels | Partial<Labels> | Labels creators to override the defaults. Use this prop to customize the aria-label attributes in DayPicker. |
lang | string | 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> | Localization in the format expected by the component. |
max | number | Maximum allowed value. |
min | number | Minimum allowed value. |
mode | "single" | "multiple" | "multiple" | "range" | "range" | undefined | Selection mode. |
modifiers | Record<string, Matcher | Matcher[]> | Add modifiers to the matching days. |
modifiersClassNames | ModifiersClassNames | Change the class name for the day matching the `modifiers`. |
modifiersStyles | ModifiersStyles | Change the class name for the day matching the {@link modifiers}. |
month | Date | The month displayed in the calendar. As opposed to `defaultMonth`, use this prop with `onMonthChange` to change the month programmatically. |
navLayout | "around" | "after" | 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, DayPicker preserves its legacy layout, but the tab order may not align with the visual order when using `captionLayout="dropdown"`. |
nonce | string | A cryptographic nonce ("number used once") which can be used by Content Security Policy for the inline `style` attributes. |
noonSafe | boolean | 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). |
numberOfMonths | number | The number of displayed months. |
numerals | "latn" | "arab" | "arabext" | "deva" | "geez" | "beng" | "guru" | "gujr" | "orya" | "tamldec" | "telu" | "knda" | "mlym" | "thai" | "mymr" | "khmr" | "laoo" | "tibt" | 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 |
onDayBlur | DayEventHandler<FocusEvent<Element, Element>> | Event handler when a day is blurred. |
onDayClick | DayEventHandler<MouseEvent<Element, MouseEvent>> | Event handler when a day is clicked. |
onDayFocus | DayEventHandler<FocusEvent<Element, Element>> | Event handler when a day is focused. |
onDayKeyDown | DayEventHandler<KeyboardEvent<Element>> | Event handler when a key is pressed on a day. |
onDayMouseEnter | DayEventHandler<MouseEvent<Element, MouseEvent>> | Event handler when the mouse enters a day. |
onDayMouseLeave | DayEventHandler<MouseEvent<Element, MouseEvent>> | Event handler when the mouse leaves a day. |
onMonthChange | MonthChangeEventHandler | Event fired when the user navigates between months. |
onNextClick | MonthChangeEventHandler | Event handler when the next month button is clicked. |
onPrevClick | MonthChangeEventHandler | Event handler when the previous month button is clicked. |
onSelect | OnSelectHandler<Date> | OnSelectHandler<Date[]> | OnSelectHandler<Date[]> | OnSelectHandler<DateRange> | OnSelectHandler<DateRange> | Action or selection made by the user. |
pagedNavigation | boolean | Paginate the month navigation displaying the `numberOfMonths` at a time. |
required | false | true | false | true | false | true | undefined | Indicates that a value is required. |
resetOnSelect | boolean | When `true`, clicking a day starts a new range if there is no current start date or if a range is already complete. In those cases, the clicked day becomes the start of the new range. |
reverseMonths | boolean | Render the months in reversed order (when {@link numberOfMonths} is set) to display the most recent month first. |
reverseYears | boolean | Reverse the order of years in the dropdown when using `captionLayout="dropdown"` or `captionLayout="dropdown-years"`. |
role | "dialog" | "application" | Semantic role of the element. Keep the default role unless a change is justified. |
showOutsideDays | boolean | 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 | Show the week numbers column. Weeks are numbered according to the local week index. |
startMonth | Date | The earliest month to start the month navigation. |
style | CSSProperties | React inline styles. |
styles | Partial<Styles> | Change the inline styles of the HTML elements. |
timeZone | string | 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. |
title | string | Title or supplementary information. |
today | Date | The today’s date. Default is the current date. This date will get the `today` modifier to style the day. |
useAdditionalDayOfYearTokens | boolean | Enable `YY` and `YYYY` for day of year tokens when formatting or parsing dates. |
useAdditionalWeekYearTokens | boolean | Enable `DD` and `DDDD` for week year tokens when formatting or parsing dates. |
weekStartsOn | 0 | 1 | 2 | 3 | 4 | 5 | 6 | The index of the first day of the week (0 - Sunday). Overrides the locale's default. |
TypeScript definition
Review each component's properties and published declaration. Native and accessibility attributes are inherited from the element specified by its type.
Calendar69 properties
Calendar · TypeScript
1declare function Calendar({ className, classNames, showOutsideDays, components, fullWidth, ...props }: CalendarProps): React.JSX.Element;API generated from @kivora/nextjs 0.2.0View package