Select
import * as Select from '@dxos/react-ui/Select';A select lets the user pick one value from a list, or several with multiple. You build it from these parts:
Select.Roottakesitems, a list of{ value, label, disabled?, icon? }. It also takesvaluewithonValueChange, ordefaultValue.- Use
multipleonSelect.Rootto let the user pick several values. The popup then stays open while the user chooses, andSelect.Triggerlists the chosen labels. Select.Triggershows the chosen label, or itsplaceholder.Select.Contentholds oneSelect.Itemper item. Give eachSelect.Itemitsitem.
| Part | What it is |
|---|---|
Select.Root |
The root, which holds the options and the value |
Select.Label |
The select’s name |
Select.Trigger |
The button that shows the chosen option and opens the list |
Select.Content |
The popup that lists the options |
Select.Item |
One option |
Select.ItemIcon |
The option’s icon |
Select.ItemText |
The option’s text. The option’s label by default |
Select.ItemIndicator |
The check shown while the option is selected |
Select.ItemGroup |
A group of options |
Select.ItemGroupLabel |
The group’s name |
Select.Separator |
A rule between options |