Select
A non-searchable custom picker (styled ListBox). For filter/multi, use ComboBox.
Signature
Density
Viewport
Theme and light/dark are set in the top barWhen to use
- Use it when Choose one option from a known, short-to-medium list.
- Reach for something else when Searchable or multi-select needs — use
ComboBox.
Accessibility
Always render a visible <label> (the label prop wires htmlFor/id for you). Errors set aria-invalid and are announced via aria-describedby. Required fields expose aria-required.
Install and import
npx shadcn@latest add @prism/select
import { Select } from '@/components/prism/Select';
In a no-build prototype, read it from the bundle instead: const { Select } = window.PrismDesignSystem_39d121;
Props
| Prop | Type | Required | Description |
|---|---|---|---|
label | React.ReactNode | — | Visible label. Without one, set aria-label or aria-labelledby. |
description | string | — | Id of an element that names the field. |
errorMessage | string | — | |
isRequired | boolean | — | |
isInvalid | boolean | — | |
isDisabled | boolean | — | |
items | (string | SelectItem | SelectSection)[] | — | Options as strings or { value, label, isDisabled } objects, optionally grouped as { section, items } (the same shape ComboBox takes). |
value | string | null | — | Controlled selected value. null = controlled with nothing selected; omit (undefined) for uncontrolled. |
defaultValue | string | — | Uncontrolled initial value. |
onSelect | (value: string, item: SelectItem) => void | — | Fired with the chosen value (and item, when items are objects). |
onChange | (value: string) => void | — | Convenience alias fired with the chosen value. |
placeholder | string | — | |
size | "sm" | "md" | — | "sm": the compact trigger for table cells. Default is the standard control height. |
name | string | — | Form field name. When set, the value submits with the enclosing form (via a hidden native select). |
form | string | — | Id of the form to submit with, when the Select sits outside it. |
autoComplete | string | — | Autofill hint for the hidden native select, e.g. "country". |
id | string | — | |
children | React.ReactNode | — | Legacy: <option> children are parsed into items when items is omitted. |
width | "xs" | "sm" | "md" | "lg" | "full" | — | Maximum width: "xs" (8rem) | "sm" (12rem) | "md" (20rem) | "lg" (36rem) | "full" (default). A cap, not a fixed width — it still shrinks on a phone or in a narrow FormRow column; the label and messages follow it. Sizes are the --field-width-* tokens. |
className | string | — |