Calendar
A month calendar for picking a date, styled with CK-UI tokens on top of react-day-picker, which provides the date logic and the keyboard behaviour. Use it inline, or through Date Picker in forms.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
Pick a day with the mouse or keyboard.
Installation
Add Calendar to your project with the CK-UI CLI. It copies the source into your project, so the code is yours to change.
- Adds
Calendar.tsxto your CK-UI folder (src/components/ck-ui by default)- Installs
react-day-pickerreact-iconsif your project does not have them yet
First time with CK-UI in this project? Run npx ck-ui-cli@latest init once before adding components. The installation guide explains what it sets up.
Manual installationInstall the packages and copy the files yourself.
Install the following dependencies
Run these commands in your terminal to install the required packages
Create or update your Calendar component
Copy this code to create your Calendar component
Test Your Component
- 1. Add the component to a test page
- 2. Check all props and variants work as expected
- 3. Verify responsive behavior
- 4. Test with different content/data
- 5. Ensure accessibility features work correctly
Disabled Dates
disabled takes dates, ranges, { dayOfWeek }, { before } / { after } and functions. A footer is announced politely.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
Min / Max
min and max disable dates outside the range and disable the month buttons past it.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
Locale
Import a locale from react-day-picker/locale: month and day names, labels and the first day of the week follow it. The default is en-US. showOutsideDays={false} hides days from other months.
| lu | ma | me | je | ve | sa | di |
|---|---|---|---|---|---|---|
| Mo | Di | Mi | Do | Fr | Sa | So |
|---|---|---|---|---|---|---|
Accessibility
- The month is a
role="grid"named by its caption ("June 2026"); the caption is a polite live region, so month changes are announced. - Each day is a button with a full label ("Tuesday, June 16th, 2026", plus "Today" or "selected"). The selected cell has
aria-selected. - The grid is one tab stop. Arrows move by day and week, PageUp/PageDown by month, Shift+PageUp/PageDown by year, Home/End to the start and end of the week. Enter or Space selects.
- Disabled days are announced as unavailable and cannot be selected; the previous/next buttons are disabled at min/max.
- Today has a ring and bold text, the selected day a filled background — neither relies on color alone.
API Reference
Single-date mode of react-day-picker (other DayPicker props pass through). Import with import * as Calendar from "@/components/ui/Calendar".
Calendar.Root
| Prop | Type | Default | Description |
|---|---|---|---|
selected | "Date" | "undefined" | Selected date (controlled). |
onSelect | "(date: Date | undefined) => void" | "undefined" | Called when a day is chosen or unchosen. |
month / defaultMonth / onMonthChange | "Date" | "current month" | The displayed month. |
min / max | "Date" | "undefined" | Earliest / latest selectable date. |
disabled | "Matcher | Matcher[]" | "undefined" | Dates that cannot be selected. |
locale | "DayPickerLocale" | "en-US" | From react-day-picker/locale. |
weekStartsOn | "0 – 6" | "locale" | First day of the week. |
showOutsideDays | "boolean" | "true" | Show days of adjacent months. |
today | "Date" | "now" | Which day is marked as today. |
footer | "ReactNode" | "undefined" | Text under the grid, announced politely. |
autoFocus | "boolean" | "false" | Focus the selected day (or today) on mount. |
className | "string" | "undefined" | Additional classes, merged last. |
classNames | "Partial<ClassNames>" | "CK-UI styles" | Override classes per part (react-day-picker keys). |