Select
The Select component is an accessible, customizable dropdown that lets users choose from multiple options. Ideal for forms or settings, Select streamlines user input by organizing choices in a clean, interactive way, keeping interfaces intuitive and clutter-free.
Favorite fruit
Structure
API Reference
x-data="select"
The root component containing the state and functionality.
Property | Type | Description | Default |
---|---|---|---|
value | string | The currently selected value. This can also used to set a default value. | "" |
open | boolean | Whether the select list is open or not. | false |
label | string | The label for the select component wich sets the aria-label. Alternatively you can add an element with x-ref="label wich will be used for aria-labelledby. | "" |
placement | enum "top" | "right" | "bottom" | "left" | Preferred placement of the select list relative to the trigger element | bottom |
offset | number | Distance in pixels between select list and trigger | 10 |
flip | boolean | Wether the select list should flip when not enough space is available | true |
shift | object | Shifts select list position for view optimization | {
"padding": 10
} |
arrow | boolean | Display an arrow pointing to the trigger. Needs an element with x-ref="arrow" inside the content element.` | true |
onOpenChange | function | Callback when select open state changes | null |
onValueChange | function | Callback when the selected value changes | null |
x-data="selectItem"
A select item, which must be a child of the content element.
Property | Type | Description | Default |
---|---|---|---|
value | string | The value of the item. | "" |
label | string | The label of the item. | "" |
disabled | boolean | Whether the item is disabled or not. | false |