Select
Displays a list of options for the user to pick from—triggered by a button.
Made by shadcnInstallation
Loading component...
When to use
Select components provide single-option selection from a list of options. Use this decision tree:
Usage
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select"<Select>
<SelectTrigger className="w-[180px]">
<SelectValue placeholder="Theme" />
</SelectTrigger>
<SelectContent>
<SelectItem value="light">Light</SelectItem>
<SelectItem value="dark">Dark</SelectItem>
<SelectItem value="system">System</SelectItem>
</SelectContent>
</Select>Anatomy
The Select component is built with Base UI primitives:
<Select> (Root Container)
├── <SelectTrigger> (Button)
│ ├── <SelectValue> (Placeholder/Selected)
│ └── <ChevronDown> Icon
├── <SelectContent> (Dropdown)
│ ├── Portal rendering
│ ├── Positioning system
│ └── <SelectItem> (Options)
│ ├── Checkmark indicator
│ └── Item text
└── Keyboard/Mouse handlingProps
Examples
Scrollable
Loading component...
Groups
Loading component...
Disabled options
Loading component...
With description
Loading component...
With icon
Loading component...
Status indicator
Loading component...
Avatars
Loading component...
Custom rendering
Loading component...
Object values
Loading component...
Placeholder and clearable
Loading component...
Error state
Loading component...
Loading state
Loading component...
Form
Loading component...
Keyboard interactions
| Key | Action |
|---|---|
Enter / Space / ArrowDown on SelectTrigger | Opens the listbox and focuses the currently selected item (or the first if none). |
ArrowUp / ArrowDown | Moves between options. |
Home / End | Jumps to first / last option. |
Enter | Selects the focused option and closes the listbox. |
Escape | Closes without changing selection. |
| Typing a character | Typeahead jumps to the next option whose label starts with that character. |
Accessibility
SelectTriggeris a real button witharia-haspopup="listbox"andaria-expanded; the listbox carriesrole="listbox"and each itemrole="option"witharia-selected.- Provide a visible label via
<Label htmlFor>or wrap the select in a<Field>so the selected value has a programmatic name. onValueChangeis the Radix-style single-argument(value: string) => void; the compat layer narrows Base UI's(value, details)signature.- For large option lists (>20), prefer
Comboboxso users can type-ahead-filter. Select's typeahead only jumps to matching first letters.
Credits
- We use Base UI for the select component.
- We take our inspiration from Shadcn UI for the select style.
Recent changes
- patchv1.2.0Pin shipped dependency floors to the version we develop against. Registry items now declare ranges like `^5.1.9` (the actual installed version) instead of collapsing to `^5.0.0`, so consumers start on the known-tested b…#133
- minorv1.1.0Theme docs refresh, readability pass on semantic foregrounds, and consumer-facing Base UI regression fixes.#121
- minorv1.0.0Post-Base-UI polish. Public API unchanged.#116
- majorv1.0.0Migrate every Radix-based primitive to `@base-ui/react@^1.4.0` (Base UI).#114
- patchv0.3.1**Accordion** - `AccordionTrigger` now shows `cursor-pointer` on hover.#112
Built by malinskibeniamin. The source code is available on GitHub.