Calendar
FormsDisplays a month grid for choosing a single date, with optional disabled dates and visual marks.
Try it
Add to your project
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/calendar.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/calendar.json https://luv-jeri.github.io/cojeev-ui/r/typography.jsonUsing calendar
Use selected and onSelect for a controlled date, or defaultSelected for local selection.
Pass disabled date matchers for unavailable days and required when the chosen date must remain selected.
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.
CalendarProps
| Prop | Type | Required |
|---|---|---|
mode | "single" | No |
selected | Date | No |
defaultSelected | Date | No |
onSelect | (date: Date | undefined) => void | No |
disabled | Matcher | Matcher[] | No |
marks | Record<string, CalendarMark> | No |
required | boolean | No |
Accessibility
Preserve the calendar day and navigation parts for their keyboard and date-label behavior.
Explain the meaning of colored marks in nearby text or date labels instead of using color alone.
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.