SelectupdateUPDATE
Displays a list of options for the user to pick from—triggered by a button.
Usage
The Popover component provides a way to display rich content in a portal when triggered by a button. It supports accessibility features, positioning options, and customizable styling.
Select Props
The Select component is composed of several parts, each with their own props.
The root element is the parent component that holds the select. Using the autocomplete
prop, you can enable autocomplete functionality. Autcomplet is built using Ariakit ComboboxProvider
Prop | Type | Default |
---|---|---|
multiple | boolean | false |
autocomplete | boolean | false |
autocompleteMode | "auto" | "manual" | "auto" |
searchValue | string | - |
defaultSearchValue | string | - |
onSearch | (value: string) => void | - |
Select.Trigger Props
The button that triggers the Select.
Prop | Type | Default |
---|---|---|
size | "small" | "medium" | - |
variant | "default" | "filter" | - |
iconProps | Record<string, any> | - |
ariaLabel | string | - |
ariaDescribedby | string | - |
ariaRequired | boolean | - |
ariaInvalid | boolean | - |
Select.Content Props
The container that holds the Select items.
Prop | Type | Default |
---|---|---|
searchPlaceholder | string | "Search..." |
position | "item-aligned" | "popper" | "popper" |
className | string | - |
Select.Item Props
Individual clickable options within the Select.
Prop | Type | Default |
---|---|---|
value | string | - |
className | string | - |
Select.Group
A way to group related Select items together.
Prop | Type | Default |
---|---|---|
className | string | - |
asChild | boolean | - |
Select.Label
Renders a label in a Select group. This component can only be used inside Select.Group
Prop | Type | Default |
---|---|---|
className | string | - |
asChild | boolean | - |
Select.Separator
Visual divider between Select items or groups.
Prop | Type | Default |
---|---|---|
className | string | - |
asChild | boolean | - |
Examples
Basic Select
Icon
You can pass leadingIcon
prop to Select.Item to include items
Size
Variant
With Separator
Multiple Selection
To enable multiple selection, pass the multiple
prop to the Select root element.
When multiple selection is enabled, the value, onValueChange, and defaultValue will be an array of strings.
Autocomplete
To enable autocomplete, pass the autocomplete
prop to the Select root element.
By default, only select items are filtered using a simple match. For more advanced control, set autocompleteMode="manual"
and implement your own custom filtering logic.
Accessibility
The Select component follows WAI-ARIA guidelines:
- Trigger has role
combobox
- Content has role
listbox
- Items have role
option
- ARIA labels and descriptions