Skip to content

Select

Accessible dropdown for picking one value from a list. Built on React Aria with full keyboard navigation and ARIA listbox semantics.

  • stable
  • since v0.1.0
  • 1.57 kB
  • form
  • input

Uses React Aria Select; role="listbox" popup with aria-selected items; full keyboard navigation and typeahead.

Preview
Open
tsx

Rendered as a segmented control: the value and the chevron sit as raised tiles inside a tinted, padded track (the same container NumberInput and Input use). variant tints the track.

Use the section field in the items array to automatically group items under section headers.

Preview
Open
tsx
Preview
Open
tsx
Preview
Open
tsx
PropTypeDefaultDescription
value
string|null
Currently selected value (controlled). The current value (controlled).
defaultValue
string|null
Initial value (uncontrolled). The default value (uncontrolled).
onValueChange
((value: T) => void)
Called when the selection changes.
placeholder
string
"Select…" 'Select an item' (localized)
Shown when nothing is selected. Temporary text that occupies the select when it is empty.
label
string
Visible label (rendered as the trigger's accessible name when no children label is passed).
aria-label
string
Aria label when no visual label is available. Defines a string value that labels the current element.
size
"sm"|"md"|"lg"
"md"
Control size.
variant
"outline"|"filled"|"ghost"
"outline"
Visual treatment matching the shared form-control vocabulary.
disabled
boolean
Disables interaction.
required
boolean
Marks the field as required for form submission.
invalid
boolean
Renders the invalid state and sets `aria-invalid`.
name
string
Submitted form field name. The name of the input, used when submitting an HTML form.
id
string
Element id. The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).
items
readonly SelectItemData<T>[]
Data-driven items — overrides `children`. Sections group by `section`.
children
ReactNode
JSX children (`<SelectItem>` / `<SelectSection>`). Ignored when `items` is passed.
className
string
style
CSSProperties
ref
Ref<HTMLButtonElement>
  • Built on React Aria — the popup uses role="listbox" with role="option" items and aria-selected.
  • Full keyboard navigation: Arrow keys move focus, Enter/Space selects, Escape closes.
  • Typeahead: typing a character jumps to the first matching item.
  • Pass items with a section field for automatic grouping — no JSX needed.
  • Use onValueChange to trigger async side effects when the user picks a value.