Skip to main content
03 / Components

Select

Choose one option from a list. Use over a native dropdown when custom styling, search, or grouping is needed.

Preview

Selected: md

States

Select has three rendered states: default (interactive), open (popover visible), and disabled (non-interactive, legible). The open state appears when a user clicks the trigger; the disabled state is shown below alongside the default for comparison.

default
disabled

Usage

Do

Use Select when there are five or more options to choose from.

Don’t

Use Select for binary choices — use Switch or Toggle instead.

Do

Provide an accessible name via aria-label or a visible label tied to the trigger.

Don’t

Default to no selection unless the absence is meaningful — show a placeholder.

Do

Order options by relevance or frequency, not alphabetically by default.

Don’t

Hide the most-used option deep in a long list when frequency is known.

Code

1const [value, setValue] = useState('md')
2
3<Select.Root value={value} onValueChange={setValue}>
4 <Select.Trigger className="lex-select__trigger">
5 <Select.Value />
6 <Select.Icon><Caret /></Select.Icon>
7 </Select.Trigger>
8 <Select.Portal>
9 <Select.Content className="lex-select__content">
10 <Select.Viewport className="lex-select__viewport">
11 <Select.Item value="sm" className="lex-select__item">
12 <Select.ItemText>Small</Select.ItemText>
13 </Select.Item>
14 <Select.Item value="md" className="lex-select__item">
15 <Select.ItemText>Medium</Select.ItemText>
16 </Select.Item>
17 <Select.Item value="lg" className="lex-select__item">
18 <Select.ItemText>Large</Select.ItemText>
19 </Select.Item>
20 </Select.Viewport>
21 </Select.Content>
22 </Select.Portal>
23</Select.Root>

Design tokens

TokenUsage
--color-surfaceTrigger background and content panel
--color-borderTrigger and content border
--color-border-strongTrigger border on hover
--color-textTrigger value text
--color-text-2Item label text
--color-text-mutedCaret icon colour
--color-surface-2Highlighted item background
--color-accentSelected item label
--shadow-mdContent popover elevation
--lex-radius-mdTrigger and content corner radius
--lex-radius-smItem corner radius

Accessibility

Select implements the WAI-ARIA combobox / listbox pattern via Radix. The trigger is a real <button>; the popover uses role="listbox" internally. Type-ahead matches the first character of an item label.

Space/Enter/Open the popover
EscClose the popover and return focus to the trigger
/Move highlight between items
EnterSelect the highlighted item and close
Home/EndMove highlight to first / last item
Type-aheadMove highlight to the first item starting with the typed character