Select
Choose from a fixed set of options without text filtering.
Installation
pnpm dlx shadcn@4.18.0 add @siteplane/selectComplete the one-time setup first. Registry JSON lists source files and dependencies.
For this page’s examples, also install:
pnpm dlx shadcn@4.18.0 add @siteplane/button @siteplane/form @siteplane/inputField is installed with Input.
Usage
import {
Select,
SelectItem,
SelectPopup,
SelectTrigger,
SelectValue,
} from "@/siteplane/components/select";
<Select items={[{ value: "design", label: "Design team" }]}>
<SelectTrigger aria-label="Workspace">
<SelectValue placeholder="Choose workspace" />
</SelectTrigger>
<SelectPopup>
<SelectItem value="design">Design team</SelectItem>
</SelectPopup>
</Select>;Composition
Select
├── SelectLabel
├── SelectTrigger → SelectValue
└── SelectPopup / SelectContent
├── SelectGroup → SelectGroupLabel + SelectItem
└── SelectSeparatorControlled selection
value stores the option ID, such as "design"; items maps it to the displayed label, such as "Design team". Pass the mapping to Select so a preselected value displays its label before the popup opens. Disabled items cannot be selected.
Alternatively, provide the display label explicitly as SelectValue children, as shown in Team settings. The item value remains the value used for selection and native form submission.
Multiple selection
Set multiple to let people choose several options; value and defaultValue become arrays. Pass a function to SelectValue to summarize a long selection in the trigger. The check of a selected item draws in when the item is picked and out when it is not, the way the Checkbox check does, and appears instantly under reduced motion.
Groups
Group related options with SelectGroup and SelectGroupLabel, and divide groups with SelectSeparator. SelectLabel still names the whole control.
Options with icons
Use object items when options carry an icon or other data. A SelectValue function renders the selected object in the trigger, and itemToStringValue supplies the value submitted with a form.
Variants and disabled
variant belongs to SelectTrigger, not the root. The ghost trigger is for a value inside a row, so it is shown small and as wide as its text. Set disabled on Select to block interaction.
Sizes
size belongs to SelectTrigger too. Omit it to inherit the provider's control size.
Form integration
Set name and required on Select to submit the selected item’s value with a Form. Inside a Field, the Form blocks a submit without a selection and focuses the trigger, and FieldError shows the message. Uncontrolled selection resets with the form; controlled state needs your own reset handler.
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
Select. | Record<string, ReactNode> | { value, label }[] | grouped items | unset | Map stored values to SelectValue labels. Supply when IDs differ from display text. |
Select | ReactNode | (value) => ReactNode | label resolved from items, otherwise raw value | Override selected-value display without changing the stored or submitted value. |
Select | SelectTriggerSize: sm | md | lg | xl | provider / lg | Control dimensions. |
Select | SelectTriggerMode: default | elevated | ghost | inset | default | Trigger surface. Ghost draws no field chrome, only the value and caret with hover and pressed levels, for a value that sits in a row. Pair it with size sm and a width that fits the text. |
Select | Positioner side / alignment | bottom / start | Preferred position. |
Select | Positioner offsets | 8 / 0 | Gap and alignment offset. |
Select | boolean | false | Align selected item with the trigger. |
Select | Positioner anchor | trigger | Custom anchor. |
Select | Portal.Props | unset | Portal options. |
Select. | Value or Value[] in multiple mode | uncontrolled | Selection. |
Select. | (value, eventDetails) => void | unset | Selection callback. |
Select. | (open, eventDetails) => void | unset | Visibility callback. |
Select preserves the generic Base UI Root contract (Value, Multiple) and
adds a hidden disabled reset marker. SelectTrigger wraps the foundation trigger
with SelectButton, which is also exported for composition. SelectButton alone
supplies appearance and caret, not select behavior; the Combobox page shows it
as the trigger of a searchable
select. SelectValue, Item, Group,
GroupLabel, Label and Separator wrap corresponding Base UI
Select parts. Popup includes
Portal, Positioner, scroll arrows and List; SelectContent aliases Popup.
SelectPrimitive is the namespace. SelectButtonProps and the trigger size/mode
types are exported. Styled classes are strings. Item supplies its own
text/indicator, with foundation value/disabled props.
Usage notes
Arrow keys and typing navigate options; Enter selects and Escape closes. Use Combobox for selection with search, or Autocomplete for text that may differ from suggestions. A placeholder is not an accessible label.