A plain <select> rendered on the server. In browsers with customizable select (appearance: base-select) the picker becomes a styled popover with icons, a second line of text and a check mark, and the closed field shows the icon of the chosen option. Other browsers keep their own native picker, with the field styled like Input. The value, form submission, required, reset and keyboard all come from the browser.
Browser Support
Limited availability4 featuresDetails
Styles the picker, option icons and descriptions. They are added after hydration, because browsers with the old HTML parser strip tags inside <select>. Without support the browser shows its native picker with plain option text.
Dims the placeholder while nothing is picked. Without it the placeholder uses the normal text color.
Fades the picker in when it opens. Without it the picker appears at once.
Fades the picker out when it closes. Without it the picker disappears at once.
Preview
Installation
Usage
import { Rocket, Sparkles, Users } from "lucide-react"
import { Select, SelectOption } from "@/components/ui/select"
export function PlanSelect() {
return (
<Select name="plan" defaultValue="team">
<SelectOption value="hobby" icon={<Sparkles />} description="1 project">
Hobby — free
</SelectOption>
<SelectOption value="pro" icon={<Rocket />} description="Unlimited projects">
Pro — $20/mo
</SelectOption>
<SelectOption value="team" icon={<Users />} description="SSO, roles, audit log">
Team — $60/mo
</SelectOption>
</Select>
)
}Examples
Groups, placeholder and sizes
SelectGroup renders <optgroup>. placeholder adds a hidden empty option, so the form will not submit a required field until something is chosen. Sizes are sm, md and lg.
<Select name="country" placeholder="Choose a country" size="sm" required>
<SelectGroup label="Europe">
<SelectOption value="de" icon="🇩🇪">Germany</SelectOption>
<SelectOption value="fr" icon="🇫🇷">France</SelectOption>
</SelectGroup>
<SelectGroup label="Americas">
<SelectOption value="us" icon="🇺🇸">United States</SelectOption>
<SelectOption value="ca" icon="🇨🇦">Canada</SelectOption>
</SelectGroup>
</Select>Controlled value
value and onValueChange from a client component. onValueChange receives the string value; the regular onChange still works.
Current value: acme
"use client"
const [workspace, setWorkspace] = React.useState("acme")
<Select value={workspace} onValueChange={setWorkspace}>
<SelectOption value="acme" icon={<Building2 />} description="12 members">
Acme Inc.
</SelectOption>
<SelectOption value="personal" icon={<Building2 />} description="Only you">
Personal
</SelectOption>
</Select>Inside a form
name, required, disabled options, defaultValue and reset are all native. The disabled region cannot be picked.
<form action={deploy}>
<Select name="region" placeholder="Where to deploy" required>
<SelectOption value="fra1" icon={<Server />} description="Frankfurt, Germany">
eu-central (fra1)
</SelectOption>
<SelectOption value="gru1" icon={<Server />} description="Capacity limit reached" disabled>
sa-east (gru1)
</SelectOption>
</Select>
<Select name="runtime" defaultValue="node22" size="sm">
<SelectOption value="node22">Node.js 22</SelectOption>
<SelectOption value="bun">Bun 1.2</SelectOption>
</Select>
<Button type="submit">Deploy</Button>
<Button type="reset" variant="outline">Reset</Button>
</form>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | - | Selected value (controlled) |
| defaultValue | string | - | Initial value when uncontrolled |
| onValueChange | (value: string) => void | - | Called with the new value. Only from a client component, like any function prop |
| placeholder | string | - | Text while nothing is selected. Adds a hidden empty option |
| size | "sm" | "md" | "lg" | "md" | Field height and padding |
| wrapperClassName | string | - | Classes for the wrapper: width, margins |
| ...props | ComponentProps<"select"> | - | Any <select> attribute: name, required, disabled, aria-invalid… |
| SelectOption.value | string | - | Option value |
| SelectOption.icon | ReactNode | - | Leading icon. Only in browsers with customizable select |
| SelectOption.description | ReactNode | - | Second line in the open picker. Only in browsers with customizable select |
| SelectGroup.label | string | - | Group heading |
Components
| Component | Description |
|---|---|
| Select | The <select> field with a chevron and a hidden placeholder option |
| SelectOption | <option> with an optional icon and description; any option attribute such as disabled |
| SelectGroup | <optgroup> with a heading |
Features
- Server first: the field and plain options render on the server and work without JavaScript; a tiny client part only adds the rich markup
- Native forms: FormData, required, reset and autofill need no extra code
- Keyboard and screen readers: the browser handles arrows, type-ahead, Escape and announcements
- Mobile: phones keep their system picker wheel or sheet
- Reduced motion: the picker opens without the fade and slide