Date Picker
An input-anchored single-date picker with presets, time selects, booked dates, popup placement, and RTL — built on Calendar, dependency-free.
Installation#
pnpm dlx shadcn@latest add @davinciui/date-pickerUsage#
Composition#
Use the following composition to build a Date Picker:
Popover
├── PopoverTrigger
│ └── Button
└── PopoverContent
└── CalendarAPI Reference#
| Prop | Type | Default |
|---|---|---|
valueControlled selected date. | Date | null | — |
defaultValueUncontrolled initial date. | Date | null | null |
onValueChangeFires on pick, preset, clear, and time edits. | (date: Date | null) => void | — |
placeholderInput placeholder. | string | "Pick a date" |
disabledDisable the whole control. | boolean | false |
invalidError state with aria-invalid. | boolean | false |
showClearButtonInline X that clears the date. | boolean | false |
showTimeSelectHour/minute selects bound to the value. | boolean | false |
presetsQuick-pick buttons; values can be Dates or factories. | DatePickerPreset[] | — |
disabledDatesBooked days — array, predicate, or both. | Date[] | ((date: Date) => boolean) | — |
formatDateDisplay formatter for the input. | (date: Date) => string | — |
localeBCP-47 locale for calendar and readout. | string | "en-US" |
weekStartsOnFirst weekday, 0 = Sunday. | 0 | 1 | 2 | 3 | 4 | 5 | 6 | "0" |
calendarSystemGrid calendar system. | "gregory" | "persian" | "islamic" | "gregory" |
dirText direction. | "ltr" | "rtl" | "ltr" |
placementPreferred popup alignment; flips to stay in viewport. | "bottom-start" | "bottom-end" | "top-start" | "top-end" | "bottom-start" |
openControlled popup state. | boolean | — |
defaultOpenUncontrolled initial popup state. | boolean | false |
onOpenChangeFires when the popup opens or closes. | (open: boolean) => void | — |
classNameExtra classes for the root. | string | — |
inputClassNameExtra classes for the text input. | string | — |
calendarClassNameExtra classes for the inner calendar. | string | — |
Accessibility#
The trigger exposes an aria-label describing the current date and opens a popup with role='dialog' and aria-label 'Choose date'. Calendar days are buttons with full-date labels, aria-pressed, and roving tabindex; arrow keys and live month and selection announcements work. Escape closes and focus returns.
Motion#
The popup animates 150ms opacity, translate, and 0.96 to 0.97 scale with cubic-bezier(0.23,1,0.32,1); calendar month changes use motion-safe keyframe animations, and day buttons use short scale transitions. Reduced motion disables the popup transition and transform via motion-reduce utilities.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

