Calendar
Date selection, single-date popovers, and date-range popovers powered by DayPicker.
Use Calendar for an inline date grid, DatePicker for one date in a popover, and DateRangePicker for a start and end date. All three use the same selection values and calendar behavior.
Powered by DayPicker for date-grid behavior, keyboard navigation, and accessible labels. Zenos owns the public selection API, popup composition, and styling.
pnpm dlx @zentara-co/zenos-cli add calendarThe command installs @daypicker/react and adds three consumer-owned files:
calendar.tsx— inline calendar with single, multiple, and range selection.date-picker.tsx— shared picker state plus single-date Root, Trigger, and Content.date-range-picker.tsx— range state built on the same trigger and content parts.
Import these files through the path configured by your project:
import { Calendar } from "./components/calendar";import { DatePicker } from "./components/date-picker";import { DateRangePicker } from "./components/date-range-picker";Calendar selection modes
Section titled “Calendar selection modes”Calendar supports single, multiple, and range modes. The mode narrows the value and callback types, so keep value, defaultValue, and onValueChange consistent with it.
Single date
Section titled “Single date”Use single selection for appointments, deadlines, and effective dates. Omitting mode also selects this behavior.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
Review on Sep 15, 2026
Multiple dates
Section titled “Multiple dates”Use multiple selection when dates are independent rather than a continuous interval, such as maintenance windows or attendance days.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
2 maintenance dates selected.
Date range
Section titled “Date range”Range selection returns { from, to }. During selection, from can exist before to; handle that partial state in labels and validation.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
Sep 10, 2026 – Sep 16, 2026
Availability and boundaries
Section titled “Availability and boundaries”Use min and max for inclusive selection boundaries. Add disabled for business rules inside that interval. It accepts one DayPicker matcher or an array of matchers, including dates, ranges, day-of-week objects, and predicate functions.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
Choose a weekday in the next 30 days.
Keep unavailable dates visibly disabled instead of rejecting them only after submission. Put server-side availability behind a feature hook and pass the resolved matchers into Calendar.
Controlled and uncontrolled state
Section titled “Controlled and uncontrolled state”Use value with onValueChange when the selection participates in form state, validation, or another component. Use defaultValue when Calendar can own the selection after initialization.
Visible-month state is separate from selected-value state. Control navigation with month and onMonthChange, or provide only defaultMonth for an uncontrolled initial month.
const [month, setMonth] = useState(new Date(2026, 8));const [date, setDate] = useState<Date>(); <Calendar value={date} onValueChange={setDate} month={month} onMonthChange={setMonth} />;Calendar API
Section titled “Calendar API”| Prop | Type | Default | Description |
|---|---|---|---|
mode | 'single' | 'multiple' | 'range' | single | Selection model and value type. |
value | Date | Date[] | DateRange | undefined | — | Controlled selection for the active mode. |
defaultValue | Date | Date[] | DateRange | undefined | — | Initial selection when Calendar owns its state. |
onValueChange | (value) => void | — | Runs when the selection changes; value follows mode. |
disabled | Matcher | Matcher[] | — | Dates unavailable for selection. |
min / max | Date | — | Earliest and latest selectable dates, inclusive. |
month / defaultMonth | Date | — | Controlled or initial visible month. |
onMonthChange | (month: Date) => void | — | Runs after visible-month navigation. |
numberOfMonths | number | 1 | Number of consecutive visible months. |
locale / timeZone | Locale / string | — | DayPicker localization and IANA time zone configuration. |
className / native div props | string / HTMLAttributes<HTMLDivElement> | — | Styles or labels the calendar wrapper. |
DatePicker
Section titled “DatePicker”DatePicker.Root ├── DatePicker.Trigger └── DatePicker.Content └── Calendar mode="single"
DatePicker.Root provides single-date state to its nested Calendar. Selecting a date closes an open picker and returns focus to the trigger. Use open, defaultOpen, and onOpenChange when popup visibility needs an external owner.
The trigger uses the same visual variants as Zenos Input and integrates with Field.Root for id, disabled, required, invalid, description, and error semantics.
Choose an available date.
Use a controlled picker when another part of the screen needs the selected date. Calendar inherits the picker’s value and callback when no local value or defaultValue is supplied.
import { Field } from "@zentara-co/zenos-ui"; <Field.Root required> <Field.Label>Deployment date</Field.Label> <DatePicker.Root value={date} onValueChange={setDate}> <DatePicker.Trigger> {date ? date.toLocaleDateString() : "Choose deployment date"} </DatePicker.Trigger> <DatePicker.Content> <Calendar min={new Date()} /> </DatePicker.Content> </DatePicker.Root> <Field.Description>Weekdays only.</Field.Description></Field.Root>;DateRangePicker
Section titled “DateRangePicker”DateRangePicker.Root ├── DateRangePicker.Trigger └── DateRangePicker.Content └── Calendar mode="range"
The first selection keeps the popup open with a partial { from } value. Selecting an end date completes the range, closes the popup, and returns focus to the trigger.
The picker closes after both dates are selected.
Use two visible months when the expected ranges commonly cross a month boundary. For narrow layouts, keep one month or ensure the containing surface can accommodate the two-month grid.
Single-month range picker
Section titled “Single-month range picker”Use one visible month when the picker appears in a narrow surface or most ranges stay within the same month. Users can still navigate between months to select a range that crosses a month boundary.
A single calendar keeps the picker compact on narrow layouts.
Picker Root API
Section titled “Picker Root API”| Prop | Type | Default | Description |
|---|---|---|---|
value / defaultValue | Date | DateRange | undefined | — | Controlled or initial picker selection; the exact type depends on the picker. |
onValueChange | (value) => void | — | Runs when the nested Calendar changes selection. |
open / defaultOpen | boolean | — | Controlled or initial popup visibility. |
onOpenChange | (open: boolean) => void | — | Runs when popup visibility changes. |
modal | boolean | false | Uses Base UI modal popover behavior when enabled. |
Trigger and Content API
Section titled “Trigger and Content API”| Prop | Type | Default | Description |
|---|---|---|---|
Trigger.variant | InputVariant | default | Input-compatible trigger surface. |
Trigger.render | ReactElement | function | — | Composes the trigger with another button-like control. |
Trigger.disabled | boolean | false | Prevents the picker from opening; Field disabled state is inherited. |
Content.side / align | Base UI position values | bottom / start | Preferred popup placement relative to the trigger. |
Content.sideOffset | number | 4 | Distance in pixels between trigger and popup. |
className | string | — | Styling escape hatch on Trigger, Content, or Calendar. |
Localization and time zones
Section titled “Localization and time zones”Pass a DayPicker locale object and format the trigger label with the same locale. Use an IANA timeZone when the product’s calendar day must not depend on the viewer’s machine time zone.
import { enGB } from "@daypicker/react/locale"; <Calendar locale={enGB} timeZone="Europe/London" />;Keep the stored domain value and display formatting deliberate. A JavaScript Date is an instant, while many product concepts—birthdays, billing days, booking dates—represent a calendar date without a time.
Accessibility
Section titled “Accessibility”DayPicker supplies grid semantics, accessible day labels, and arrow-key navigation. Keep these behaviors intact:
- Give standalone calendars an
aria-labelwhen the surrounding heading does not identify their purpose. - Use the trigger text to communicate the current value; do not rely on placeholder color alone.
- Leave disabled dates focus-safe and visibly distinct.
- Announce validation through
Field.Errorandaria-invalidrather than changing color only. - Preserve Escape-to-close and focus return for both picker variants.