Calendar
Calendar shows a monthly grid of days to pick a single date, several dates or a date range.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
Import
Install from npm, copy the source into your project with @yugen-ui/cli or the shadcn CLI, or import directly when working in this repo.
// npm install yugen-uiimport { Calendar } from "yugen-ui";Variants
Each tile is a standalone example: hover to copy, or press Code to see the source.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
Range selection
mode="range": the first and last days get a brand background, the days between a brand tint.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
Multiple days & disabled days
mode="multiple"; disabled={{ dayOfWeek: [0, 6] }} disables weekends.
Usage
- Use Calendar on its own when the calendar is the main content (booking, picking time off).
- Disable invalid days with disabled instead of reporting an error after the pick.
- Don't use Calendar for birth dates far from today. Allow typing or use a year dropdown (captionLayout="dropdown").
- Don't show more than 2 months side by side on narrow screens.
Props
| Prop · Type | Default | Description |
|---|---|---|
| mode"single" | "multiple" | "range" | Default: — | Selection mode. |
| selected / onSelectDate | Date[] | DateRange | Default: — | Value, depending on mode. |
| disabledMatcher | Matcher[] | Default: — | Disabled days (Date, { before }, { after }, { dayOfWeek }…). |
| numberOfMonthsnumber | Default: 1 | Number of months shown. |
| showOutsideDaysboolean | Default: true | Shows days of the previous / next month (foreground-4). |
| localeDayPickerLocale | Default: vi | Language; import it from react-day-picker/locale. |
| …DayPickerProps | Default: — | Any other react-day-picker v10 prop. |
Messages
Text built into the component: labels, aria-labels, screen reader announcements.
English by default. Change it with the messages prop of YugenProvider, by the namespace below; messagesVi has the Vietnamese set. See Interface language.
messages.calendar
| Key · Type | Default (English) | messagesVi |
|---|---|---|
| localeLocale | undefined Locale của react-day-picker: tên tháng / thứ, nhãn trợ năng của nút và ô ngày, ngày đầu tuần. Prop | Default (English)undefined | messagesVivi |