Calendar
A dependency-free date picker with single and range selection, Jalali and Hijri calendar systems, full keyboard navigation, animated month transitions, time selects, presets, booked dates, week numbers, and full RTL support.
Installation#
pnpm dlx shadcn@latest add @davinciui/calendarUsage#
About
Calendar renders a month grid with zero date dependencies — all calendar arithmetic is derived from the platform Intl API, which is also what powers the Jalali and Hijri systems. Selection is controlled or uncontrolled, booked days are disabled via array or predicate, and every visual option (cell size, week numbers, time selects, direction) is a plain prop.
Outside days from the neighbouring months render muted and stay selectable; picking one jumps the view to its month. Range mode normalises reversed picks, and time selects write straight into the selected date.
The grid is fully keyboard navigable with a single tab stop: arrows move by day (mirrored in RTL) or week, Home / End jump to week edges, PageUp / PageDown change months (with Shift for years), and Enter selects the focused day. Month changes glide with a direction-aware slide.
Date Picker#
Persian / Hijri / Jalali Calendar#
Selected Date (With TimeZone)#
Basic#
Range Calendar#
Month and Year Selector#
Presets#
Date and Time Picker#
Booked dates#
Custom Cell Size#
Week Numbers#
RTL#
API Reference#
| Prop | Type | Default |
|---|---|---|
modeSelection mode. | "single" | "range" | "single" |
selectedControlled selection. | Date | DateRange | null | — |
defaultSelectedUncontrolled initial selection. | Date | DateRange | null | null |
onSelectFires on every pick. | (value: Date | DateRange | null) => void | — |
monthControlled visible month (any date within it). | Date | — |
defaultMonthUncontrolled initial visible month. | Date | today |
onMonthChangeFires when the visible month changes. | (month: Date) => void | — |
disabledBooked days — array, predicate, or both. | Date[] | ((date: Date) => boolean) | — |
localeBCP-47 locale for names and digits. | string | "en-US" |
weekStartsOnFirst weekday, 0 = Sunday. Pass explicitly for locale conventions (e.g. 6 for fa-IR). | 0 | 1 | 2 | 3 | 4 | 5 | 6 | "0" |
showWeekNumbersISO-8601 week column. | boolean | false |
showMonthYearPickerMonth + year dropdowns. | boolean | false |
cellSizeDay cell size in px. | number | 36 |
showTimeSelectHour/minute selects bound to the selection. | boolean | false |
timeValueControlled "HH:MM" time. | string | — |
defaultTimeValueUncontrolled initial time. | string | "12:00" |
onTimeChangeFires when the time selects change. | (value: string) => void | — |
calendarSystemGrid calendar system (Intl-driven). | "gregory" | "persian" | "islamic" | "gregory" |
dirText direction with mirrored navigation. | "ltr" | "rtl" | "ltr" |
classNameExtra classes for the root. | string | — |
Accessibility#
Day cells are buttons with full-date aria-labels, aria-pressed and aria-current, navigated by roving tabindex with arrows, Home/End and PageUp/PageDown. Month titles use aria-live, though the grid exposes no role=grid.
Motion#
Changing months replays a keyed slide using motion-safe animation classes, and day buttons scale on hover over 150ms. CSS motion-reduce disables the slide, transitions and hover/active scaling.
Changelog#
- Full keyboard navigation with roving tabindex (arrows, Home/End, PageUp/PageDown, Shift for years — RTL-aware)
- Direction-aware month slide transitions
- Capsule range pill with glowing gradient endpoints and RTL-safe logical radius
- Today dot indicator and locale-aware full-date labels
- ISO week numbers
- RTL layout with locale-aware first weekday
- Persian (Jalali) and Hijri calendar systems
- Single and range selection
- Month/year dropdowns
- Time selects
- Booked (disabled) dates
- Custom cell size
RTL Support#
Pass dir="rtl" together with a right-to-left locale such as ar-EG or fa-IR. Navigation chevrons mirror automatically, weekday order follows the locale's first day (Saturday for Arabic and Persian), and day numbers render in locale digits. Nothing else changes — selection, ranges, and disabled logic are direction-agnostic.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

