Select
Pick one or more values from a list—as a plain dropdown, a searchable list or a text input with suggestions.
Installation
pnpm dlx shadcn@latest add @sui/selectInstall with the shadcn CLI or use the shared @workspace/ui package. Follow the installation guide to configure the registry, load styles, and choose import aliases.
Usage
import {
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectList,
SelectTrigger,
SelectValue,
} from "@workspace/ui/components/select"const items = [
{ label: "Light", value: "light" },
{ label: "Dark", value: "dark" },
{ label: "System", value: "system" },
]
<Select items={items}>
<SelectTrigger className="w-[180px]">
<SelectValue placeholder="Theme" />
</SelectTrigger>
<SelectContent>
<SelectList>
{items.map((item) => (
<SelectItem key={item.value} value={item.value}>
{item.label}
</SelectItem>
))}
</SelectList>
</SelectContent>
</Select>Composition
Select takes its shape from the parts you put in it. Every shape shares SelectContent, SelectList and SelectItem.
Select
├── SelectTrigger ← plain dropdown
│ └── SelectValue
├── SelectInput ← text input as the trigger
├── SelectChips ← multiple values as chips
│ ├── SelectChip
│ └── SelectChipsInput
└── SelectContent
├── SelectSearch ← search box inside the popup
├── SelectEmpty
└── SelectList
├── SelectGroup
│ ├── SelectLabel
│ └── SelectItem
├── SelectSeparator
└── SelectItemSearchable
The popup has no search box until you add one: put SelectSearch inside SelectContent to filter the list. Static SelectItem children are filtered too when Select has items. Without it the arrow keys and Enter still work.
Input
Use SelectInput outside SelectContent to make the text input the trigger.
Clear
Add showClear to SelectInput to show a button that clears the value.
Multiple
Set multiple on Select and show the values with SelectChips. Pass the anchor from useSelectAnchor to SelectContent so the popup lines up with the chips.
Free Text
Control inputValue to keep whatever the user types, including text that matches no item. The list only suggests.
Groups
Use SelectGroup, SelectLabel, and SelectSeparator to organize items.
With a search input, render groups from items with SelectCollection.
Scrollable
A select with many items that scrolls.
Disabled
Invalid
Add the data-invalid attribute to the Field component and the aria-invalid attribute to the SelectTrigger component to show an error state.
<Field data-invalid>
<FieldLabel>Fruit</FieldLabel>
<SelectTrigger aria-invalid>
<SelectValue />
</SelectTrigger>
</Field>RTL
To enable RTL support in shadcn/ui, see the RTL configuration guide.
API Reference
Select is built on Base UI Combobox. See the Base UI Combobox documentation.