Select
A closed list of options in a popup, for choosing exactly one value, built on Base UI Select.
Select the field to open the list. Use the arrow keys to move, Enter to pick and Escape to close.
When to use
- To pick one value from a short, fixed list (up to about 10 options): status, document type, relationship.
- When the user must choose from the list and cannot type a new value.
- Inside forms next to other fields, where a native-feeling control is expected.
When not to use
- Long lists or lists that need search. Use Combobox.
- Free text with suggestions. Use Autocomplete, or Creatable combobox when the user can also keep a value that is not in the list.
- Commands and navigation. Use Command.
- Two or three options always visible. Use a radio group or a segmented control, so users see every choice without opening anything.
Which one to use
| Component | The user | Options | Value | Typical use |
|---|---|---|---|---|
| Select | Picks from a list | Fixed, short | One of the options | Status, type, role |
| Combobox | Searches, then picks | Long or loaded from an API | One of the options | Customer, template, model |
| Creatable combobox | Searches, picks or types | Suggestions | An option or free text | Field name, tag |
| Autocomplete | Types and gets suggestions | Filtered as they type | One option, shown as a chip | Search for a person or entity |
| Command | Types to find an action | Actions and pages | Runs an action, holds no value | Global search, shortcuts |
Sizes
Pass the same size to SelectTrigger, SelectValue and SelectContent so the text and the list match the field. The default is md.
| Size | Height | Use for |
|---|---|---|
lg |
56px | Prominent fields on simple pages |
md |
48px | Default for forms |
sm |
40px | Dense forms, filters, side panels |
xsm |
36px | Table toolbars and inline editing |
States
Escolha um status para continuar.
| Variant | Use for |
|---|---|
default |
No validation feedback yet. |
error |
The value is missing or invalid. Pair it with a message in aria-describedby. |
success |
The value was accepted. Use sparingly. |
blocked |
The value is set by the system and cannot be changed. Same as disabled with a filled background. |
highlight draws attention to a field the user must look at, such as one changed by an automation. disabled removes the field from the tab order.
Examples
Groups
Group options when the list has clear families. SelectLabel names the group and SelectSeparator divides them.
Unavailable option
Use disabled on a SelectItem for a choice that exists but is not allowed now. The user still sees why the list is not complete.
Content
- Label every select above the field: “Status da tarefa”, not “Selecione”.
- The placeholder is an instruction, not a label: “Selecione o status”.
- Options are short nouns or noun phrases in sentence case: “Aguardando revisor”.
- Order options by how the user thinks (workflow order, most used first), not alphabetically, unless the list is long and unknown.
- Pass
itemstoSelectso the trigger shows the option label (not the stored value) before the list has opened.
Do and don’t
Accessibility
- Built on Base UI Select: the trigger is a
buttonwithrole="combobox",aria-haspopup="listbox"andaria-expanded. The popup is alistboxofoptionelements and the selected one hasaria-selected. - Keyboard:
Enter,SpaceorArrowDownopens the list; arrows move; typing letters jumps to a matching option (typeahead);Enterselects;Escapecloses and returns focus to the trigger. - The trigger needs an accessible name. Pair it with a
LabelthroughhtmlForandid, or setaria-label. - For errors, set
variant="error"and pointaria-describedbyto the message. The red border alone is not enough. - The focus state is the
focusborder color; keep it visible when you override the width. - Disabled items (
SelectItem disabled) are skipped by arrow navigation.
Code
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@repo/ui/select";
const items = [
{ label: "Em análise", value: "analysis" },
{ label: "Em revisão", value: "review" },
];
<Select items={items} onValueChange={setStatus} value={status}>
<SelectTrigger aria-label="Status da tarefa">
<SelectValue placeholder="Selecione o status" />
</SelectTrigger>
<SelectContent>
{items.map((item) => (
<SelectItem key={item.value} value={item.value}>
{item.label}
</SelectItem>
))}
</SelectContent>
</Select>;
Inside a form, wrap SelectTrigger with FormControl and keep value={field.value ?? null}.
Props
Select| Prop | Type | Default | Description |
|---|---|---|---|
defaultValue | string | null | — | Initial value when the select is uncontrolled |
disabled | boolean | false | Disables the whole select |
items | { label: ReactNode; value: unknown }[] | — | Options as `{ label, value }[]`. Lets the trigger show the label of the selected value before the popup has ever opened |
onValueChange | (value: string | null, details) => void | — | Called when the user picks an option |
value | string | null | — | Controlled value. Use `null` for no selection |
SelectTrigger| Prop | Type | Default | Description |
|---|---|---|---|
size | "lg" | "md" | "sm" | "xsm" | "md" | Height and text size of the field. |
variant | "default" | "error" | "success" | "blocked" | "default" | Validation state. `blocked` also disables the trigger. |
highlight | boolean | false | Draws a highlight border to call attention to the field. |
disabled | boolean | false | Disables the trigger. |
SelectValue| Prop | Type | Default | Description |
|---|---|---|---|
placeholder | ReactNode | — | Shown while there is no value. Pass translated copy from the app. |
size | "lg" | "md" | "sm" | "xsm" | "md" | Text size. Match the trigger. |
children | ReactNode | (value) => ReactNode | — | Custom rendering of the selected value. |
SelectContent| Prop | Type | Default | Description |
|---|---|---|---|
size | "lg" | "md" | "sm" | "xsm" | "md" | Minimum width and text size of the list. Match the trigger. |
side | "top" | "bottom" | "left" | "right" | "bottom" | Preferred side of the trigger. |
align | "start" | "center" | "end" | "center" | Alignment against the trigger. |
sideOffset | number | 4 | Gap in pixels between trigger and list. |
alignItemWithTrigger | boolean | false | Aligns the selected option over the trigger, like a native select. |
collisionPadding | number | — | Minimum distance from the viewport edges. |
SelectItem| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | Value passed to `onValueChange`. Required. |
disabled | boolean | false | Makes the option unavailable. |
SelectGroup, SelectLabel and SelectSeparator take only standard element props. SelectContent renders its own positioner; use SelectPortal only to choose a custom portal container.
Known issues
| Issue | Effect |
|---|---|
SelectSeparator uses bg-muted, and SelectItem uses focus:text-accent-foreground. The preset has only old-muted and old-accent colors. |
The separator line does not render and the focused option gets no text color from that class. |
The disabled trigger and disabled items use disabled:opacity-50 / data-disabled:opacity-50; the trigger hover uses hover:bg-neutral-black/5, and the chevron opacity-50. |
Translucent fills and dimming against the repository rule of solid colors; contrast on disabled text is below the other disabled states. |
size is not shared: SelectTrigger, SelectValue and SelectContent each take their own. |
A trigger sm with a default content gets a larger list and text unless all three are set. |
SelectItem always uses text-sm, whatever the size. |
Options in a lg select look smaller than the selected value. |
| There is no empty state. | An empty SelectContent opens a blank box. Use Combobox when the list can be empty. |