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.
Add via CLI
Section titled “Add via CLI”npx @a2ra/cli add date-pickerSingle date
Section titled “Single date”Date range
Section titled “Date range”Example JSON
Section titled “Example JSON”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" }}DatePicker props
Section titled “DatePicker props”| Prop | Type | Description |
|---|---|---|
label | string | Visible label |
name | string | Form field name |
value | string | Controlled date (ISO 8601: YYYY-MM-DD) |
defaultValue | string | Uncontrolled default |
minValue | string | Earliest selectable date |
maxValue | string | Latest selectable date |
granularity | day defaulthourminutesecond | Time granularity shown |
firstDayOfWeek | sunmontuewedthufrisat | First day of the week (defaults to locale) |
isOpen | boolean | Controlled calendar open state |
defaultOpen | truefalse default | Opens calendar on mount |
isDisabled | truefalse default | Disables the picker |
isRequired | truefalse default | Marks as required |
isInvalid | truefalse default | Shows error styling |
isReadOnly | truefalse default | Prevents editing |
autoFocus | truefalse default | Focuses on mount |
validationBehavior | aria defaultnative | Validation strategy |
description | string | Helper text |
errorMessage | string | Error text when isInvalid is true |
DateRangePicker additional props
Section titled “DateRangePicker additional props”All DatePicker props apply, plus:
| Prop | Type | Description |
|---|---|---|
startName | string | Form field name for the start date |
endName | string | Form field name for the end date |
allowsNonContiguousRanges | truefalse 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). Whengranularityis"hour"or finer, include a time component. - The calendar popup is keyboard-navigable with arrow keys;
Enterselects a date.