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.
Interactive Preview
Section titled “Interactive Preview”Group 7A
Group 7B
Group 8A
Group 8B
Group 7A
Group 7B
Group 8A
Group 8B
Group 7A
Group 7B
Group 8A
Group 8B
Group 7A
Group 7B
Group 8A
Group 8B
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"]} /><script lang="ts"> import Select from "@/components/ui/select.svelte";</script>
<script lang="ts"> const group = [ { label: "Group 7A", value: "7a" }, { label: "Group 7B", value: "7b" }, ];</script>
<Select label="Group" items={group} defaultValue={["7a"]} />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"]} />Installation
Section titled “Installation”Run the Glaceon CLI in your project root to automatically install the headless logic and copy the styled wrapper into your components folder.
npx @glaceon/cli add select --framework react # or svelte, solidInstall the Zag.js dependencies:
bun add @zag-js/react @zag-js/select @zag-js/collectionCopy your framework’s implementation into your project. (Note: Code blocks omitted for brevity in preview, please refer to the source repository for full component code).
Data Attributes
Section titled “Data Attributes”| 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. |
API Reference (Props)
Section titled “API Reference (Props)”| 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. |
Keyboard Interactions
Section titled “Keyboard Interactions”| 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. |