Command Palette

Search for a command to run...

Select

Displays a list of options for the user to pick from—triggered by a button.

Usage

import { Select } from "@smartacteam/ambient-web/select";
 
const fonts = [
  { label: "Select font", value: null },
  { label: "Sans-serif", value: "sans" },
  { label: "Serif", value: "serif" },
  { label: "Monospace", value: "mono" },
  { label: "Cursive", value: "cursive" },
];
<Select.Root>
  <Select.Trigger className="w-45">
    <Select.Value />
  </Select.Trigger>
  <Select.Content>
    <Select.Item value="light">Light</Select.Item>
    <Select.Item value="dark">Dark</Select.Item>
    <Select.Item value="system">System</Select.Item>
  </Select.Content>
</Select.Root>

Examples

Sizes

Scrollable

Grouped

Wrap related items in a Select.Group with a Select.GroupLabel — the label is announced as the group's name by screen readers. Grouping expresses structure, not spacing (see Styling), so put a Select.Separator between adjacent groups to draw the boundary.

Multiple

Pass multiple to Select.Root to let the user pick several values. The popup stays open while toggling items, each selected item shows a checkmark, and Select.Value renders the selected labels. Provide items on the root so the trigger can resolve labels from values.

Count badge

Swap Select.Value for Select.CountValue to lead the trigger with a count Badge. The badge is shrink-0, so it stays pinned while long selections ellipsize — the number selected is always visible. Labels resolve from the root's items, same as Select.Value, so no extra wiring is needed.

Forward badgeProps to recolor the badge (e.g. badgeProps={{ color: "success" }}). For a fully custom summary — a "3 selected" string, an overflow +N — pass a render function to Select.Value instead.

Size-varying states

A spacing override applies to every state, including the one you were not looking at. See Styling.