Select
Picks one value from a list, with groups and typeahead.
Staticimport { Select } from 'umbra-ui'
Props
Select
| Prop | Type | Default | Description |
|---|---|---|---|
children required | ReactNode | — | `SelectItem`, `SelectGroup` and `SelectSeparator` elements. |
defaultOpen | boolean | — | Initial open state when uncontrolled. |
defaultValue | string | — | Initial value when uncontrolled. |
invalid | boolean | — | Marks the value as invalid (sets `aria-invalid`). Inherited from FormField when omitted. |
name | string | — | Field name submitted with a form. |
onOpenChange | ((open: boolean) => void) | — | Called when the listbox opens or closes. |
onValueChange | ((value: string) => void) | — | Called with the newly selected value. |
open | boolean | — | Controlled open state. |
placeholder | ReactNode | — | Text shown when no value is selected. |
required | boolean | — | Marks the field as required for form validation. |
size | "sm" | "md" | "lg" | md | Control height. |
value | string | — | Controlled value. |
SelectItem
| Prop | Type | Default | Description |
|---|---|---|---|
children required | ReactNode | — | Option label. |
value required | string | — | Value reported to `onValueChange` and submitted with forms. |
SelectGroup
| Prop | Type | Default | Description |
|---|---|---|---|
label required | ReactNode | — | Visible group heading, announced with the group. |
Usage notes
Built on Radix Select. Remaining props go to the trigger button.
Accessibility
- Trigger has
role="combobox"; the list is alistboxwithoptions. - Space, Enter or ↓ opens; ↑/↓ move; Home/End jump; typing jumps to a matching option; Escape closes and returns focus.
SelectGrouplabels its options for screen readers.
Import
import { Select, SelectItem, SelectGroup } from 'umbra-ui';
import 'umbra-ui/styles.css'; // once, at the root of your app