Base · Forms
Select
Picks one option from a list that opens on demand.
HTML / JSDraftReactStableReact NativeDraftSwift (SwiftUI)PlannedGodotPlannedVueDraftSvelteDraftSolidDraft
Reviewed
Props
tsx
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
const services = [
{ value: "road", label: "Road freight" },
{ value: "air", label: "Air freight" },
{ value: "sea", label: "Sea freight" },
]
<Select items={services}>
<SelectTrigger className="w-56" aria-label="Service">
<SelectValue placeholder="Choose a service" />
</SelectTrigger>
<SelectContent>
{services.map((service) => (
<SelectItem key={service.value} value={service.value}>
{service.label}
</SelectItem>
))}
</SelectContent>
</Select>Overview
A select keeps a longer list of options out of the way until it is needed. The trigger shows the current choice; opening it reveals the full list.
When to use
- For one choice from roughly five to fifteen options.
- When space is tight and the options do not need to be compared side by side.
When not to use
- For two to five options: use Radio Group so they are all visible.
- For long lists that need searching: use Combobox.
- For actions rather than values: use Dropdown Menu.
Anatomy
Trigger
Looks like an input, with a chevron. Shows the selected label or a placeholder.
Popup
The list of options, raised on a shadow.md surface.
Item
One option. The selected item shows a check mark.
Props
The contract every language implements. Names follow each language’s conventions (camelCase in React, snake_case in Rust).
| Prop | Type | Default | Description |
|---|---|---|---|
| size | "sm" | "default" | default | Trigger height. |
| disabled | boolean | false | Prevents opening and dims the trigger. |
| placeholder | string | Choose a service | Shown when nothing is selected. |
| value | string | – | The selected option's value. |
| onValueChange | function | – | Called with the newly selected value. `onchange` in Dioxus. |
States
- Closed
- Trigger shows the selection or placeholder.
- Open
- Popup is visible and focus is inside the list.
- Item highlighted
- Hover or arrow-key focus fills the item with color.bg.hover.
- Disabled
- 50% opacity; cannot be opened.
Accessibility
Role: combobox + listbox
| Keys | Action |
|---|---|
| Enter/Space/Arrow Down | Opens the list from the trigger. |
| Arrow Up/Arrow Down | Moves the highlight between options. |
| Enter/Space | Selects the highlighted option and closes the list. |
| Escape | Closes the list without changing the selection. |
| A–Z | Jumps to the next option starting with that letter. |
- Give the trigger a label.
- Focus returns to the trigger when the list closes.
Design tokens
Change any of these in Foundations and this component follows, in every language.
Platform notes
- HTML / JS
- Draft
- A styled native <select>, so the open list is the operating system's own picker. `size` goes on the wrapper, `disabled` on the <select>. No script.
- React
- Stable
- Matches the contract with no platform differences.
- React Native
- Draft
- Options are passed as an `options` array. On phones the list opens as a bottom sheet, the platform convention for pickers on touch screens; on tablets and web it drops down under the trigger, as wide as it, with arrow-key navigation.
- Swift (SwiftUI)
- Planned
- Not built in Swift yet.
- Godot
- Planned
- Not built in Godot yet.
- Vue
- Draft
- Usage snippet only; items are rendered with v-for rather than an items prop.
- Svelte
- Draft
- Usage snippet only (Svelte 5); binds value and shows the selected label in the trigger.
- Solid
- Draft
- Usage snippet only; built on Kobalte, so options are a list of values and the item component renders each one.