Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

Select

A single-value picker. Trigger, value text, indicator, positioned content and items all come from @zag-js/select, so keyboard navigation, typeahead and focus return are correct without hand-rolled state.

import { Select } from "@/components/ui/select";
const group = [
{ label: "Group 7A", value: "7a" },
{ label: "Group 7B", value: "7b" },
];
<Select label="Group" items={group} defaultValue={["7a"]} />

Run the Glaceon CLI in your project root to automatically install the headless logic and copy the styled wrapper into your components folder.

Terminal window
npx @glaceon/cli add select --framework react # or svelte, solid
Element Data Attribute Value Description
trigger data-state "open" | "closed" Popover visibility. Drives the border and the indicator rotation.
trigger data-placeholder-shown "" Present when nothing is selected, so the placeholder can be muted.
trigger data-disabled "" Present when the select is disabled.
indicator data-state "open" | "closed" Rotates 180 degrees while open.
content data-state "open" | "closed" Popover visibility.
item data-state "checked" | "unchecked" The selected item.
item data-highlighted "" The keyboard-highlighted item.
item data-disabled "" Present when the item cannot be chosen.
Prop Type Default Description
items { label: string, value: string }[] required Builds the Zag ListCollection.
defaultValue string[] undefined Initially selected value. Zag’s select is multi-value at the machine level, so this is an array.
placeholder string "Select" Shown through data-placeholder-shown when nothing is selected.
label string undefined Renders a <label> wired to the trigger.
name string undefined Name for the hidden native select, so the value participates in form submission.
disabled boolean false Disables the whole control.
class / className string undefined Extra classes, appended last.
Key Description
Enter / Space Opens the list, or selects the highlighted item.
ArrowDown / ArrowUp Moves the highlight.
Home / End Jumps to the first or last item.
Esc Closes the list and returns focus to the trigger.
Any character Typeahead to the next matching item.