Date Picker
A calendar popover that picks a civil date stored as YYYY-MM-DD.
Usage guidelines
- Use
DatePickerfor a civil date stored asYYYY-MM-DD, such as a report day or an expiry date. UseTimePickerfor a wall timeHH:mmandDateTimePickerfor an instant (Date) shown in an IANA time zone. The pickers do not accept typed text. - A date-only value has no time zone. Parse API payloads and convert business values outside the picker.
- Name the field at the call site: prefer one visible picker Label. It names both the trigger and the popup through
aria-labelledby, and clicking its text focuses the trigger without opening it. A Label withclassName="sr-only"names a compact field without visible text.FieldLabel nativeLabel={false} render={<div />}also works. Do not point a nativelabel[for]at the trigger: activating it clicks the button. - Without a Label, name the trigger and the content with
aria-labeloraria-labelledby. The trigger's name appends its visible value (or placeholder) to label text; an explicitaria-labelreplaces the whole name, so include the visible value in it. Put meaningful annotations inside the Value part so they join the name. - Name Clear explicitly: Clear follows the
IconButtonnaming contract, so give it anaria-labelsuch as "Clear start date". Place it next to the trigger, never inside the trigger button. - Use
defaultValue, orvaluewithonValueChange, and keep that choice for the field's lifetime.nullmeans empty, and Clear emitsnull.details.reasonisitem-press,clear-pressorreset;details.cancel()rejects that change and its follow-up close. Unchanged values do not emit again. - Selecting a day commits it and closes the popup. The month and year selector only changes the displayed month; it does not select a date. Days from adjacent months stay selectable.
- Restrict dates with
minDate,maxDate(bothYYYY-MM-DD) andisDateUnavailable. Unavailable days are skipped by the keyboard and cannot be selected. - Content keeps its natural height and flips above or below the trigger; it does not shrink on small screens. Pass
maxHeightonly to opt into scrolling the body while the actions stay visible. localetakes a DayPicker locale object and changes formatting and digits, not the calendar system or the stored value. Translate action labels throughlabels, plus placeholders,requiredLabelandvalidationMessage. Direction comes from the nearestDirectionProvider; for a local RTL region, also setdiron the wrapper and on the content.- With
name, the committed value joins nativeFormData, and an empty field submits''. Inside aField,Field.nametakes precedence,validatereceives the domain value, andForm.onFormSubmitreceives the same strings asFormData. Required and invalid fields block submission and focus the first invalid trigger. Reset restoresdefaultValue. Disabled fields are left out; read-only fields open for browsing and still submit.
Anatomy
DatePickerTrigger is a native button whose default children are the Value and a decorative icon. When you replace them, include exactly one DatePickerValue; its render callback receives the formatted text, not the raw value. DatePickerContent owns the portal, initial focus and calendar.
Examples
Available dates
minDate and maxDate bound the calendar, and isDateUnavailable rules out single days such as weekends.
Weekdays only, Dec 2026–Jan 2027.
Controlled value
Control the value with value and onValueChange when another part of the page reads it. The callback's details.reason tells a day selection from Clear or a form reset.
Value: 2027-03-31
Read-only and disabled
A read-only picker stays focusable and opens for browsing, but you cannot change its value. A disabled picker leaves the tab order and form submission.
Read-only — opens for browsing, cannot be changed.
Disabled — skipped by keyboard and form submission.
Field and Form
Inside a Field, the picker registers with Form. FieldError shows the required message, and onFormSubmit receives the serialized date.
Keyboard
| Key | Action |
|---|---|
| EnterorSpace | Opens the popup from the trigger and focuses the selected day, or today when empty. |
| Left arroworRight arrow | Moves focus one day, skipping unavailable days and crossing into adjacent months. Reversed in right-to-left. |
| Up arroworDown arrow | Moves focus one week. |
| PageUporPageDown | Moves focus one month. |
| Shift+PageUporShift+PageDown | Moves focus one year. |
| HomeorEnd | Moves focus to the start or end of the week. |
| EnterorSpace | Selects the focused day, closes the popup and returns focus to the trigger. |
| Tab | Moves between the month title, the month buttons and the grid, wrapping inside the popup. |
| Escape | Closes the popup without a change and returns focus to the trigger. |
In the month and year selector, ArrowUp and ArrowDown move one option, PageUp and PageDown move five, and Home and End reach the ends. Digits locate a year and letters locate a month. Escape discards the selection and returns focus to the month title.
API reference
DatePicker
Groups all parts of a calendar date picker storing a Gregorian YYYY-MM-DD value. Doesn't render its own HTML element.
Commits changes on day selection, clearing, or form reset; integrates with Field and native form validation.
| Prop | Type | Default | Details |
|---|---|---|---|
placeholder | string | No default | |
disabled | boolean | false | |
readOnly | boolean | false | |
required | boolean | false | |
requiredLabel | string | 'Required' | |
invalid | boolean | false | |
name | string | No default | |
form | string | No default | |
validationMessage | string | No default | |
onOpenChange | ((open: boolean, details: PickerOpenChangeDetails) => void) | No default | |
children required | React.ReactNode | No default | |
locale | Partial<DayPickerLocale> | No default | |
minDate | string | No default | |
maxDate | string | No default | |
isDateUnavailable | ((date: string) => boolean) | No default | |
value | string | null | No default | |
defaultValue | string | null | null | |
onValueChange | ((value: string | null, details: DatePickerChangeEventDetails) => void) | No default | |
labels | Partial<DatePickerLabels> | No default | |
defaultOpen | boolean | false | |
open | boolean | No default | |
DatePickerClear
A button component that can be used to trigger actions. Renders a <button> element.
| Prop | Type | Default | Details |
|---|---|---|---|
aria-label | string | No default | |
aria-labelledby | string | No default | |
variant | 'default' | 'ghost' | 'ghost-accent' | 'primary' | 'secondary' | 'secondary-accent' | 'tertiary' | 'default' | |
tone | 'default' | 'destructive' | 'default' | |
ref | React.Ref<HTMLButtonElement> | No default | |
className | string | ((state: ButtonState) => string | undefined) | No default | |
style | React.CSSProperties | ((state: ButtonState) => React.CSSProperties | undefined) | No default | |
focusableWhenDisabled | boolean | false | |
Valid prop combinations:
aria-label: string,aria-labelledby?: undefined,variant?: 'default' | 'ghost' | 'primary' | 'secondary' | 'tertiary',tone?: 'default' | 'destructive'aria-label: string,aria-labelledby?: undefined,variant: 'ghost-accent' | 'secondary-accent',tone?: 'default'aria-label?: undefined,aria-labelledby: string,variant?: 'default' | 'ghost' | 'primary' | 'secondary' | 'tertiary',tone?: 'default' | 'destructive'aria-label?: undefined,aria-labelledby: string,variant: 'ghost-accent' | 'secondary-accent',tone?: 'default'
| Attribute | Description |
|---|---|
data-disabled | Present when the button is disabled. |
DatePickerContent
A container for the popover contents. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
sideOffset | number | OffsetFunction | 8 | |
align | 'center' | 'end' | 'start' | 'start' | |
className | string | ((state: PopoverPopupState) => string | undefined) | No default | |
style | React.CSSProperties | ((state: PopoverPopupState) => React.CSSProperties | undefined) | No default | |
side | 'bottom' | 'inline-end' | 'inline-start' | 'left' | 'right' | 'top' | 'bottom' | |
alignOffset | number | OffsetFunction | 0 | |
finalFocus | boolean | React.RefObject<HTMLElement | null> | ((closeType: InteractionType) => void | boolean | HTMLElement | null) | No default | |
| Attribute | Description |
|---|---|
data-open | Present when the popup is open. |
data-closed | Present when the popup is closed. |
data-starting-style | Present when the popup begins animating in. |
data-ending-style | Present when the popup is animating out. |
data-side | Values: Indicates which side the popup is positioned relative to the trigger. |
data-align | Values: Indicates how the popup is aligned relative to specified side. |
data-instant | Values: Present if animations should be instant. |
| Variable | Description |
|---|---|
--popup-width | The width of the popup. |
--popup-height | The height of the popup. |
DatePickerLabel
| Prop | Type | Default | Details |
|---|---|---|---|
className | string | ((state: FieldRootState) => string | undefined) | No default | |
style | React.CSSProperties | ((state: FieldRootState) => React.CSSProperties | undefined) | No default | |
| Attribute | Description |
|---|---|
data-disabled | Present when the component should ignore user interaction. |
data-touched | Present when the field has been touched. |
data-dirty | Present when the field value has changed from its initial value. |
data-filled | Present when the field has a value. |
data-focused | Present when the field is focused. |
DatePickerTrigger
A button that opens the popover. Renders a <button> element.
| Prop | Type | Default | Details |
|---|---|---|---|
ref | React.Ref<HTMLButtonElement> | No default | |
id | string | No default | |
className | string | ((state: PopoverTriggerState) => string | undefined) | No default | |
style | React.CSSProperties | ((state: PopoverTriggerState) => React.CSSProperties | undefined) | No default | |
| Attribute | Description |
|---|---|
data-readonly | Present when the picker is read-only. |
data-required | Present when the picker requires a value. |
data-popup-open | Present when the corresponding popover is open. |
data-pressed | Present when the trigger is pressed. |
data-disabled | Present when the trigger is disabled. |
DatePickerValue
| Prop | Type | Default | Details |
|---|---|---|---|
children | ((displayValue: string) => React.ReactNode) | React.ReactNode | No default | |