DatePicker
An accessible date-picker with a calendar popover.
Category: inputs · WCAG 2.2-AA · date, calendar, picker, input, form
Sizes
- sm
- md
- lg
States
- default
- open
- error
- disabled
Props
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | — | Base id for the input and its popover/aria wiring; auto-generated when omitted. |
value | string | — | Controlled ISO date value (YYYY-MM-DD) |
defaultValue | string | — | Uncontrolled default value |
onValueChange | (value: string | undefined) => void | — | Called with the selected ISO date string (or undefined when cleared) |
onChange | (value: string | undefined) => void | — | Deprecated: use onValueChange (same ISO string | undefined) |
min | string | — | Minimum ISO date |
max | string | — | Maximum ISO date |
clearable | boolean | false | Shows a clear button |
label | string | — | Field label |
hint | string | — | Hint text |
error | string | — | Error message |
size | 'sm' | 'md' | 'lg' | md | Field size |
disabled | boolean | false | Disables the picker |
labels | DatePickerLabels | — | i18n label overrides |
Design tokens
--cascivo-date-picker-bg--cascivo-date-picker-border--cascivo-date-picker-radius--cascivo-date-picker-day-selected-bg--cascivo-date-picker-day-today-color
When to use
- Picking a single calendar date in a form where a visual month grid helps (due dates, bookings)
- Date entry that benefits from min/max constraints and locale-aware formatting and week start
When not to use
- Selecting a time of day — use TimePicker
- Free-form or approximate dates where a plain Input is faster, or a date already known by typing
How to build an accessible DatePicker in React →
Examples
Basic
Uncontrolled date picker
<DatePicker label="Date" />Clearable
With clear button
<DatePicker label="Date" clearable />With constraints
Date range constraint
<DatePicker min="2024-01-01" max="2024-12-31" />Related components
- TimePicker — Combine when both a date and a time are needed
- Input — Use a plain input when a calendar grid is unnecessary
- Form — Typically a field within a form with label/hint/error