Select
Accessible custom select with a combobox trigger and listbox popup.
@zeus-web/selectData Entryzweb add selectGenerated
Playground
Source
Choose the framework entry that matches your application.
html
<script type="module">
import '@zeus-web/select/wc/auto'
</script>
<zw-select aria-label="Environment">
<option value="preview">Preview</option>
<option value="production">Production</option>
</zw-select>tsx
import { Select } from '@zeus-web/select/react'
export function SelectExample() {
return (
<Select aria-label="Environment">
<option value="preview">Preview</option>
<option value="production">Production</option>
</Select>
)
}vue
<script setup lang="ts">
import { Select } from '@zeus-web/select/vue'
</script>
<template>
<Select aria-label="Environment">
<option value="preview">Preview</option>
<option value="production">Production</option>
</Select>
</template>Add
bash
zweb add selectImports
Styled registry component:
tsx
import { Select } from '@/components/ui/select'Primitive React wrapper:
tsx
import { Select } from '@zeus-web/select/react'Web Component entry:
ts
import '@zeus-web/select/wc/auto'Props
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | - | Base ID used to derive the internal trigger ID; the listbox keeps its generated ID. |
value | string | - | Current selected value. |
defaultValue | string | - | Initial selected value. |
values | string[] | - | Current selected values in multiple mode. Pass as a JavaScript property. |
defaultValues | string[] | - | Initial selected values in multiple mode. Pass as a JavaScript property. |
placeholder | string | - | Text shown when no option is selected. |
size | SelectSizeValues: sm, md, lg | md | Select control size. |
multiple | boolean | - | Enables multiple selection. |
disabled | boolean | - | Disables user interaction. |
required | boolean | - | Marks the select as required for form validation. |
invalid | boolean | - | Marks the select as invalid. |
name | string | - | Form field name used during submission. |
ariaLabel | string | - | Accessible label for unlabeled selects. |
ariaLabelledby | string | - | ID reference for the visible select label. |
ariaDescribedby | string | - | ID reference for additional accessible description. |
ariaErrormessage | string | - | ID reference for the accessible error message. |
Events
| Event | React prop | Detail | Description |
|---|---|---|---|
value-change | onValueChange | value: string, values: string[], nativeEvent: Event | Emitted when selected value changes. |
focus-change | onFocusChange | focused: boolean, nativeEvent: FocusEvent | Emitted when focus enters or leaves the select trigger. |
Slots
| Slot | Description |
|---|---|
default | Option children used as the select data source. |
Styling
Uses Tailwind: yes
Theme tokens:
border-inputbg-popovertext-popover-foregroundbg-accentring-ring
Internal selectors:
[data-slot=select-trigger][data-slot=select-content][data-slot=select-option][data-slot=select-option-indicator][data-slot=select-message]
Registry
Registry source: available.
Add command: zweb add select
Type: component
Dependencies:
@zeus-web/select
Registry dependencies:
cnglobals
Files:
templates/react/select.tsx→components/ui/select.tsxtemplates/vue/select.ts→components/ui/select.ts
AI usage rules
Do:
- Use Select for single or multiple choice lists with keyboard navigation.
- Use placeholder when the field has no initial selection.
- Set values and defaultValues as JavaScript properties, not HTML attributes.
Do not:
- Do not use Select for free-form text entry or remote autocomplete.
Examples
React styled usage
tsx
import { Select } from '@/components/ui/select'
export function Example() {
return (
<Select defaultValue="apple">
<option value="apple">Apple</option>
<option value="orange">Orange</option>
</Select>
)
}