Skip to content

DatePicker / DateRangePicker

Two components: DatePicker for a single date and DateRangePicker for a start-end range. Both wrap the corresponding React Aria primitives with full keyboard and screen reader support.

Terminal window
npx @a2ra/cli add date-picker

Single date:

{
"type": "DatePicker",
"props": {
"label": "Appointment date",
"name": "date",
"minValue": "2025-01-01",
"maxValue": "2025-12-31"
}
}

Date range:

{
"type": "DateRangePicker",
"props": {
"label": "Stay dates",
"startName": "check_in",
"endName": "check_out",
"minValue": "2025-06-01"
}
}
PropTypeDescription
labelstringVisible label
namestringForm field name
valuestringControlled date (ISO 8601: YYYY-MM-DD)
defaultValuestringUncontrolled default
minValuestringEarliest selectable date
maxValuestringLatest selectable date
granularityday default
hour
minute
second
Time granularity shown
firstDayOfWeeksun
mon
tue
wed
thu
fri
sat
First day of the week (defaults to locale)
isOpenbooleanControlled calendar open state
defaultOpentrue
false default
Opens calendar on mount
isDisabledtrue
false default
Disables the picker
isRequiredtrue
false default
Marks as required
isInvalidtrue
false default
Shows error styling
isReadOnlytrue
false default
Prevents editing
autoFocustrue
false default
Focuses on mount
validationBehavioraria default
native
Validation strategy
descriptionstringHelper text
errorMessagestringError text when isInvalid is true

All DatePicker props apply, plus:

PropTypeDescription
startNamestringForm field name for the start date
endNamestringForm field name for the end date
allowsNonContiguousRangestrue
false default
Allow ranges with disabled dates in the middle
value{ start: string, end: string }Controlled range (ISO dates)
defaultValue{ start: string, end: string }Uncontrolled default range
  • Date values are plain ISO 8601 strings (YYYY-MM-DD). When granularity is "hour" or finer, include a time component.
  • The calendar popup is keyboard-navigable with arrow keys; Enter selects a date.