Select
Pick one option from a list. The trigger is the same field as Input, label and all, so a Select sits in a form without looking like a different kind of thing. The list drops from the field at its full width.
Install
npx shadcn@latest add @nelumbo/selectVariants
Filled and outlined, like Input. The label rests in the field until there's a value or the list opens; the chosen option is filled in and ticked.
filled
You can change plans at any time.
outlined
You can change plans at any time.
Groups and long lists
Group labels and separators organise long lists. Past 20rem the list scrolls. Type a few letters to jump to an option.
Choose how to be told about errors.
Without a label
Leave out label for shadcn's plain look, with the placeholder in the field: good in toolbars and table headers. size="sm" is 48px.
Icons at the end
iconPosition="end" moves an item's icon to the far end, opposite the label, and the check moves to the start so the labels stay lined up.
Nested
For options that nest, use NestedSelect: the same field, with lists that open level by level. Cascade (the default) opens each level beside its parent, like a desktop menu: hover or press → to open, ← to close. Drill shows one level at a time with a back row. Letters jump to an option; Space or Enter opens it. On a phone it always drills.
import { NestedSelect } from "@/components/ui/combobox"const locations = [ { value: "europe", label: "Europe", icon: "euro", children: [ { value: "nordics", label: "Nordics", children: ["Denmark", "Finland", "Sweden"] }, { value: "western", label: "Western Europe", children: ["France", "Ireland"] }, ], }, { value: "remote", label: "Anywhere (remote)" },]<NestedSelect label="Office" options={locations} value={office} onValueChange={setOffice} /><NestedSelect label="Office" options={locations} nestedStyle="drill" /> // one level at a timeUsage
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"<Select value={plan} onValueChange={setPlan}> <SelectTrigger label="Plan" description="You can change it later."> <SelectValue /> </SelectTrigger> <SelectContent> <SelectItem value="free">Free</SelectItem> <SelectItem value="pro" icon="star" description="Unlimited projects">Pro</SelectItem> </SelectContent></Select>// shadcn code works as is: no label, placeholder in the field<SelectTrigger className="w-[180px]"> <SelectValue placeholder="Theme" /></SelectTrigger>Props
| Prop | Type | Default | Notes |
|---|---|---|---|
SelectTrigger label | string | Floating label, as on Input | |
SelectTrigger variant | "filled" | "outlined" | "filled" | |
SelectTrigger size | "default" | "sm" | "default" | 56px or 48px |
SelectTrigger icon | IconName | Leading Material Symbol | |
SelectTrigger description / error | ReactNode | Help text; error marks it invalid | |
SelectTrigger className | string | On the field's wrapper; set the width here | |
SelectItem icon / description | IconName / ReactNode | Shown in the list only, not in the field | |
SelectItem iconPosition | "start" | "end" | "start" | At the end, the icon sits opposite the label and the check moves to the start |
SelectContent position | "popper" | "item-aligned" | "popper" | Below the field, or over it like macOS |
NestedSelect nestedStyle | "cascade" | "drill" | "cascade" | Side menus, or one panel at a time; phones always drill |
NestedSelect options | (string | ComboboxOption)[] | A tree: options with children; same props as Combobox otherwise |