DatePicker

An accessible date-picker with a calendar popover.

Category: inputs · WCAG 2.2-AA · date, calendar, picker, input, form

Sizes

States

Props

PropTypeDefaultDescription
idstring—Base id for the input and its popover/aria wiring; auto-generated when omitted.
valuestring—Controlled ISO date value (YYYY-MM-DD)
defaultValuestring—Uncontrolled default value
onValueChange(value: string | undefined) => void—Called with the selected ISO date string (or undefined when cleared)
minstring—Minimum ISO date
maxstring—Maximum ISO date
clearablebooleanfalseShows a clear button
typeablebooleantrueWhen true, the field accepts a typed date as well as one picked from the calendar.
disabledDate(date: Date) => boolean—Rejects individual dates the bounds allow — holidays, weekends, taken slots.
formatIntl.DateTimeFormatOptions—Formatting options for the displayed date. Defaults to the locale's numeric form.
showTodaybooleanfalseWhen true, the calendar offers a button that jumps to the current month.
namestring—Submitted with a surrounding form — a hidden input carrying the ISO value.
requiredboolean—Marks the control as required for assistive technology.
openboolean—Controlled open state of the calendar popup.
onOpenChange(open: boolean) => void—Called when the popup opens or closes.
labelstring—Visible field label rendered above the input; it also names the control.
hintstring—Hint text
errorstring—Error message
size'sm' | 'md' | 'lg'mdField size
disabledbooleanfalseDisables the picker
labelsDatePickerLabels—i18n label overrides
aria-labelledbystring—Wired automatically by a wrapping `Field` — its label id, forwarded to the focusable control so the Field's label names it.
aria-describedbystring—Wired automatically by a wrapping `Field` — the ids of its hint/error text, forwarded to the focusable control so the supporting text is announced.
aria-invalidboolean—Wired automatically by a wrapping `Field` when it is in an error state.
ariaLabelstring—Invisible accessible name, for when a visible element outside this component already labels it and `label` would render that text a second time. ⚠ `label` on this component is **visible**; `IconButton.label`/`Sparkline.label` are invisible names, which is the prior that costs adopters a duplicated label. The raw DOM `aria-label` still wins over this.

Design tokens

When to use

When not to use

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

← Back to docs