Skip to content

Select

select

A choice from a list too long for radio buttons. Grouped with labels, an inline check on the selected option, typeahead and arrow-key navigation from the Base UI select primitive, and a label in the trigger that rolls in the direction of the list — down for a later option, up for an earlier one.

Install

$npxshadcnadd@forme/select

Adds the component, its registry dependencies, and the token stylesheet you import once.

Usage

import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/forme/select/select";

<Select items={regions} defaultValue="eu">
  <SelectTrigger aria-label="Region">
    <SelectValue />
  </SelectTrigger>
  <SelectContent>
    <SelectItem value="eu">Europe</SelectItem>
    <SelectItem value="us">United States</SelectItem>
  </SelectContent>
</Select>

When to use

Reach for it

  • Picking one value from a list too long for radio buttons, such as a region, a timezone or a role.
  • Pass items when the options are known up front: it is what lets the trigger roll the new label in the direction you moved.

Use something else

  • Two to five options that should all be visible; use a RadioGroup or a SegmentedControl.
  • Choosing several values; that is a MultiSelect.
  • Running actions — a list of actions is a Dropdown.

API reference

Read from the source, so it is the API of the file you install. A prop marked * is required.

Select

The select and the root of it.

PropTypeDefaultDescription
itemsreadonly SelectItemDescription[]—Data structure of the items rendered in the select popup. When specified, <Select.Value> renders the label of the selected item instead of the raw value.

Also takes every prop of Base UI Select.Root.

SelectTrigger

PropTypeDefaultDescription
asChildboolean—Render as the single child element instead of a <button>, keeping the trigger behaviour.

Also takes every prop of Base UI Select.Trigger.

SelectItem

PropTypeDefaultDescription
destructiveboolean—Renders destructive: for an option the reader should think twice about.

Also takes every prop of Base UI Select.Item.

SelectField

The field wrapper: a label, the select, and a description.

PropTypeDefaultDescription
labelReact.ReactNode—The visible label. Names the trigger for a screen reader.
descriptionReact.ReactNode—Help text under the field, announced as the description.

Also takes every prop of <div> attributes.

The other parts

  • SelectValueTakes Base UI Select.Value
  • SelectContentTakes Base UI Select.Popup and Pick<ComponentProps<typeof SelectPrimitive.Positioner>, "side" | "sideOffset" | "align">
  • SelectLabelTakes Base UI Select.GroupLabel
  • SelectGroupTakes Base UI Select.Group

Accessibility

  • Base UI gives it the listbox pattern: typeahead, arrow keys, Home and End, and Esc to close.
  • The rolling label is aria-hidden; a separate visually hidden copy holds the value, so a screen reader hears one label rather than the outgoing and incoming one together.

Motion

  • The label rolls in the direction of the list — a later option rises from below, an earlier one drops from above — so the motion says which way you moved.
  • Both the value roll and the popup animate on the shared tokens, and the popup exits faster than it enters.
  • Reduced motion keeps a short crossfade and drops the movement and blur.