Date Picker
FormsOpens a calendar from a compact trigger to choose and display one date.
Try it
Add to your project
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/date-picker.jsonThe command includes the component’s shared dependencies. Your project keeps editable source files.
Include the complete example
This example also composes typography. Install its parts together:
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/date-picker.json https://luv-jeri.github.io/cojeev-ui/r/typography.jsonUsing date picker
Use date and onDateChange for controlled selection or defaultDate for a local initial date.
Pass disabled-date rules through calendarProps and formatDate to customize the displayed date.
API
Compose the exported parts below. The prop types are read from the React source during the registry build.
Native element or underlying primitive props are inherited where declared, including accessible labels, event handlers and refs.
DatePickerProps
| Prop | Type | Required |
|---|---|---|
date | Date | No |
defaultDate | Date | No |
onDateChange | (date: Date | undefined) => void | No |
open | boolean | No |
defaultOpen | boolean | No |
onOpenChange | (open: boolean) => void | No |
placeholder | string | No |
disabled | boolean | No |
calendarProps | Omit<CalendarProps, "selected" | "onSelect"> | No |
formatDate | (date: Date) => string | No |
triggerProps | React.ComponentProps<"button"> | No |
DatePickerTriggerProps
Accepts the native or primitive props declared by its exported TypeScript type.
DatePickerContentProps
Accepts the native or primitive props declared by its exported TypeScript type.
Accessibility
Use triggerProps to give the trigger a field-specific accessible name and associate any instructions with it.
Preserve the calendar and popover parts for date navigation, focus handling, and dismissal.
States and appearance
For conditional content, keep a MotionPresence boundary around keyed MotionSurface children. The shared entrance and exit states work with native primitives and respect your motion preference.
Try pointer and keyboard interaction, and switch the appearance control in the navigation to compare light and dark mode. Motion respects reduced motion preferences.