Select
Displays a list of options for the user to pick from, triggered by a button.
Preview
Fruits
Apple
Banana
Orange
Grape
Usage
<ui-select>
<ui-select-trigger class="max-w-[180px] w-full">
<ui-select-value placeholder="Select a fruit"></ui-select-value>
</ui-select-trigger>
<ui-select-content>
<ui-select-group>
<ui-select-label>Fruits</ui-select-label>
<ui-select-item value="apple">Apple</ui-select-item>
<ui-select-item value="banana">Banana</ui-select-item>
<ui-select-item value="orange">Orange</ui-select-item>
<ui-select-item value="grape">Grape</ui-select-item>
</ui-select-group>
</ui-select-content>
</ui-select>
Sub-components
<ui-select> <ui-select-trigger> <ui-select-value> <ui-select-content> <ui-select-group> <ui-select-label> <ui-select-item> <ui-select-separator> <ui-select-scroll-up-button> <ui-select-scroll-down-button>
Props
<ui-select>
| Prop | Type | Default | Description |
|---|
value | string | — | Controlled selected value. |
default-value | string | — | Default selected value. |
<ui-select-value>
| Prop | Type | Default | Description |
|---|
placeholder | string | — | Placeholder text. |
<ui-select-item>
| Prop | Type | Default | Description |
|---|
value | string | — | The item value. |
All components also accept standard HTML attributes (class, id, style, data-*, aria-*, etc.) which are passed through to the underlying element.