Skip to content

Select

A wrapper around React Aria’s Select component. Renders a button that opens a listbox with full keyboard navigation, typeahead search, and screen reader announcements.

Terminal window
npx @a2ra/cli add select
{
"type": "Select",
"props": {
"label": "Country",
"name": "country",
"placeholder": "Select a country",
"isRequired": true,
"items": [
{ "label": "Australia", "value": "AU" },
{ "label": "United Kingdom", "value": "GB" },
{ "label": "United States", "value": "US" }
]
}
}
PropTypeDescription
labelstringVisible label
placeholderstringPlaceholder shown when nothing is selected
itemsSelectItem[]List of options (see below)
valuestringControlled selected value
defaultValuestringUncontrolled default
namestringForm field name
isDisabledtrue
false default
Disables the select
isRequiredtrue
false default
Marks as required
isOpenbooleanControlled open state
defaultOpentrue
false default
Opens the listbox on mount
disabledKeysstring[]Values of disabled options
isInvalidtrue
false default
Shows error styling
validationBehavioraria default
native
Validation strategy
descriptionstringHelper text
errorMessagestringError text when isInvalid is true
FieldTypeDescription
labelstringVisible option text
valuestringSubmitted value
isDisabledbooleanDisables this option
  • Type any character to jump to the first option starting with that letter (typeahead).
  • Arrow keys navigate options; Enter or Space confirms the selection.