This page as markdown: /select.md · Index for agents: /llms.txt · Everything in one file: /llms-full.txt

Select

Status: stable

Listbox over Base UI Select — typeahead, roving focus, collision-aware popup, ARIA option wiring, and form integration. Trigger shows the selected value; the popup portals to .

Keywords: select, listbox, dropdown, picker, option, choice, typeahead, form

Usage

Use Select when users choose one value from a known, finite set. Use Combobox for searchable or user-entered values, Combobox multiple for several choices, and Radio when all options should remain visible.

Best practices

Anatomy

Part Required Description
Root yes Owns value, open state, form integration, and item collection.
Trigger yes The button that shows the selected value and opens the listbox.
Content yes The positioned popup containing options and optional groups.
Item yes A selectable option with selected and highlighted states.

Subcomponents

Name Type Description
SelectTrigger Base UI Trigger props + placeholder?: ReactNode + size?: "md" | "sm" | "xs" + className The button. Composes Trigger + Value + a chevron Icon that flips on open (data-[popup-open]). size="sm" is the same raised field one rung down, for a toolbar beside sm buttons. size="xs" is the property-grid rung — height, padding, radius AND surface move together, which is why it is a prop and not a className: the xs trigger is an inset bg-panel-field field with no border, matching ScrubField on the same row. A consumer overriding only the height gets an md-register 8px radius on a 24px box and a raised card sitting among inset fields; one inspector panel had eleven of those, and both tells are visible at a glance.
SelectContent Base UI Popup props + side, align, sideOffset + className Portal + Positioner + Popup + List. side="bottom", align="start", sideOffset=6 by default; matches trigger width.
SelectItem { value: string; disabled?: boolean; label?: string } + className An option. Composes Item + ItemText + a check ItemIndicator for the selected row. String children double as the item's label, so the closed trigger shows the display text — pass label explicitly only when children are richer than a string.
SelectGroup Base UI Group props + className Optional grouping of related options.
SelectGroupLabel Base UI GroupLabel props + className The heading associated with a SelectGroup for screen readers.
SelectValue Base UI Value props (children render fn) + placeholder Renders the selected option's label with a placeholder fallback. Already composed inside SelectTrigger; exported for advanced layouts that render the value outside the default trigger.
SelectSeparator Base UI Separator props + className A thin themed divider between groups of items. Decorative — Base UI marks it aria-hidden.

Props

Name Type Default Description
items Record<string, ReactNode> | { value: string; label: ReactNode }[] — value → label map (a record, or an array of { value, label }). Derived automatically from literal SelectItem children; pass it explicitly when the items are generated in a loop, or a closed trigger renders the raw value instead of the label.
Select (Root) Base UI Select.Root props (value, defaultValue, onValueChange, open, defaultOpen, onOpenChange, disabled, required, name, multiple, items) — Controls the selected value and open state. Uncontrolled by default. When items isn't passed, it is derived from the SelectItem children so the closed trigger shows display text instead of the raw value; pass items explicitly when item children aren't plain strings.

Tokens used

field-border, field, foreground, ring, border, popover, popover-foreground, accent, accent-foreground, muted-foreground

Motion

Accessibility

Related

Examples

Basic (controlled)

import { Select, SelectContent, SelectItem, SelectTrigger } from "@sableui/react"

<Select value={value} onValueChange={setValue}><SelectTrigger placeholder="Choose a font" /><SelectContent><SelectItem value="sans">Sans-serif</SelectItem><SelectItem value="serif">Serif</SelectItem><SelectItem value="mono">Monospace</SelectItem></SelectContent></Select>

Grouped

import { SelectContent, SelectGroup, SelectGroupLabel, SelectItem } from "@sableui/react"

<SelectContent><SelectGroup><SelectGroupLabel>Weights</SelectGroupLabel><SelectItem value="regular">Regular</SelectItem><SelectItem value="bold">Bold</SelectItem></SelectGroup></SelectContent>

Inside Field

import { Field, Select, SelectContent, SelectItem, SelectTrigger } from "@sableui/react"

<Field label="Default visibility" description="Controls how new projects appear."><Select defaultValue="public"><SelectTrigger placeholder="Choose visibility" /><SelectContent><SelectItem value="public">Public</SelectItem><SelectItem value="private">Private</SelectItem><SelectItem value="unlisted">Unlisted</SelectItem></SelectContent></Select></Field>

Rich item labels

import { Badge, Select, SelectContent, SelectItem, SelectTrigger } from "@sableui/react"

<Select defaultValue="business" items={[{ value: "business", label: "Business" }, { value: "studio", label: "Studio" }]}><SelectTrigger /><SelectContent><SelectItem value="business" label="Business"><span className="flex items-center gap-2"><Badge tone="1">Business</Badge><span>Business plan</span></span></SelectItem><SelectItem value="studio" label="Studio"><span className="flex items-center gap-2"><Badge tone="2">Studio</Badge><span>Studio</span></span></SelectItem></SelectContent></Select>