Forms
Calendar
Month grid date picker with month/year pickers, disabled dates, locale-aware labels and optional time. CalendarHeader is its navigation bar.
import { Calendar, CalendarHeader } from "datui";Playground
| Mon | Tue | Wed | Thu | Fri | Sat | Sun |
|---|---|---|---|---|---|---|
<Calendar size="m" weekStartsOn={1} />Examples
Basic
Limits
disablePast, maxDateTime and shouldDisableDate.
With time
enableTime adds hour and minute pickers and a Done button.
CalendarHeader on its own
Accessibility
- Each month is a
role="grid"named by its month and year; days are buttons named with the full localized date, today hasaria-current="date", the selected cellaria-selected. - One day is in the tab order. Arrow keys move by day (crossing into the next or previous month), PageUp/PageDown by month, Home/End to the week edges, Enter/Space select.
- Previous/next month are labelled icon buttons; month and year are labelled native selects (type-ahead and Up/Down work).
- Weekday names, month names and day labels come from
LocaleProviderviaIntl; all built-in strings are props.
API
Calendar
Month grid date picker (react-day-picker): month/year pickers, min/max and custom disabled dates, localized through `LocaleProvider`, optional time. Arrow keys move by day (crossing months), PageUp/PageDown by month, Home/End to week edges, Enter/Space select.
| Prop | Type | Default | Description |
|---|---|---|---|
| autoFocus | boolean | false | Move focus into the grid (selected day, else today) on mount. |
| changeHoursLabel | string | Hours | |
| changeMinutesLabel | string | Minutes | |
| changeMonthLabel | string | "Month" | |
| changeYearLabel | string | "Year" | |
| className | string | — | |
| defaultValue | Date | null | |
| defaultViewDate | Date | the value's month, else the current month | |
| disableFuture | boolean | — | |
| disablePast | boolean | — | |
| disablePickers | boolean | false | Plain month title instead of month/year pickers. |
| doneButtonDisabled | boolean | — | |
| doneButtonShow | boolean | true | Show the Done button under the time pickers. |
| doneButtonText | string | Done | |
| enableTime | boolean | false | Adds hour and minute pickers (not available at size `s`). |
| maxDateTime | Date | — | Latest selectable moment; also limits the time pickers on that day. |
| minDateTime | Date | — | Earliest selectable moment; also limits the time pickers on that day. |
| nextMonthIcon | ReactNode | — | |
| nextMonthLabel | string | "Next month" | |
| onChange | ((value: Date) => void) | — | Called with the picked date (keeping the current time of day). |
| onDoneButtonClick | (() => void) | — | |
| onViewDateChange | ((viewDate: Date) => void) | — | |
| prevMonthIcon | ReactNode | — | |
| prevMonthLabel | string | "Previous month" | |
| renderDayContent | ((date: Date) => ReactNode) | — | Custom content inside each day button. |
| shouldDisableDate | ((date: Date) => boolean) | — | |
| showNeighboringMonth | boolean | false | Show the leading/trailing days of neighbouring months. |
| size | "s" | "m" | m | |
| value | Date | — | |
| viewDate | Date | — | Month shown. Controlled with `onViewDateChange`. |
| weekStartsOn | 0 | 1 | 4 | 2 | 3 | 5 | 6 | 1 | First day of the week, 0 = Sunday. |
CalendarHeader
Month navigation bar: previous/next arrows and month + year pickers (native selects, localized through `LocaleProvider`). Used inside Calendar and CalendarRange; usable on its own.
| Prop | Type | Default | Description |
|---|---|---|---|
| onChange (required) | (viewDate: Date) => void | — | Called with the first day of the newly chosen month. |
| viewDate (required) | Date | — | Month shown (any day of it). |
| changeMonthLabel | string | Month | |
| changeYearLabel | string | Year | |
| className | string | — | |
| disablePickers | boolean | false | Show a plain "Month Year" title instead of month and year pickers. |
| endMonth | Date | 20 years after `viewDate` | Latest month offered by the pickers. |
| nextMonthDisabled | boolean | false | |
| nextMonthHidden | boolean | false | |
| nextMonthIcon | ReactNode | <ChevronRightIcon /> | |
| nextMonthLabel | string | Next month | |
| onNextMonth | (() => void) | — | Overrides the next-arrow action (default: one month forward via `onChange`). |
| onPrevMonth | (() => void) | — | Overrides the previous-arrow action (default: one month back via `onChange`). |
| prevMonthDisabled | boolean | false | |
| prevMonthHidden | boolean | false | |
| prevMonthIcon | ReactNode | <ChevronLeftIcon /> | |
| prevMonthLabel | string | Previous month | |
| startMonth | Date | 100 years before `viewDate` | Earliest month offered by the pickers. |