Skip to content
Cojeev UI

Date Picker

Forms

Opens a calendar from a compact trigger to choose and display one date.

React · copy into your project · light and dark themes

Try it

Loading preview…

Take it with you

Copy the example, API and usage notes for your editor or AI assistant.

Add to your project

Terminal
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/date-picker.json

The 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:

Terminal
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/date-picker.json https://luv-jeri.github.io/cojeev-ui/r/typography.json

Using 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

PropTypeRequired
dateDateNo
defaultDateDateNo
onDateChange(date: Date | undefined) => voidNo
openbooleanNo
defaultOpenbooleanNo
onOpenChange(open: boolean) => voidNo
placeholderstringNo
disabledbooleanNo
calendarPropsOmit<CalendarProps, "selected" | "onSelect">No
formatDate(date: Date) => stringNo
triggerPropsReact.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

openresthoverfocusactive

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.