Select
Choose one option from a list in a popup.
Installation
bun add @xerobi/ui
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue } from "@xerobi/ui/select"This component is client-side. In Astro, hydrate it with a client directive.
Examples
Default
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@xerobi/ui/select"
export function SelectDefault() {
const versions = [
{ value: "v1", label: "Version 1" },
{ value: "v2", label: "Version 2" },
{ value: "v3", label: "Version 3" },
]
return (
<Select defaultValue="v2" items={versions}>
<SelectTrigger className="w-56" aria-label="Version">
<SelectValue placeholder="Select version" />
</SelectTrigger>
<SelectContent>
{versions.map((v) => (
<SelectItem key={v.value} value={v.value}>{v.label}</SelectItem>
))}
</SelectContent>
</Select>
)
}API reference
Select
No props of its own.
SelectContent
No props of its own.
SelectGroup
No props of its own.
SelectItem
No props of its own.
SelectLabel
No props of its own.
SelectScrollDownButton
No props of its own.
SelectScrollUpButton
No props of its own.
SelectSeparator
No props of its own.
SelectTrigger
| Prop | Type | Description |
|---|---|---|
| size | "default" | "sm" |
SelectValue
No props of its own.
Styling hooks: [data-slot="select-group"], [data-slot="select-value"], [data-slot="select-trigger"], [data-slot="select-content"], [data-slot="select-label"], [data-slot="select-item"], [data-slot="select-separator"], [data-slot="select-scroll-up-button"], [data-slot="select-scroll-down-button"].