Select API
Properties
| Name | Type | Default | Description |
|---|---|---|---|
items | array | [] | Options for the select. Each item has type, content, and value fields. Items may be grouped. Content is not sanitized — sanitize it in your application to prevent XSS. |
name | string | — | Name attribute used when submitting in a form. |
value | string | — | Gets or sets the selected value. |
content | string | — | Returns the human-readable label of the selected item. Read-only. |
tabindex | number | 0 | Tab index of the component. |
placeholder | string | — | Placeholder text shown when no option is selected. |
disabled | boolean | false | Disables the select. |
readonly | boolean | false | Sets the read-only state. |
size | "small" | "medium" | "large" | — | Size of the select. |
inline | boolean | false | Renders the select as inline-block. |
borderless | boolean | false | Renders the select without a border. |
error | boolean | false | Sets the error state. |
loading | boolean | false | Sets the loading state of the option list. |
opened | boolean | false | Controls the open state via attribute. Use open() and close() methods for programmatic control. |
disable-min-width | boolean | false | Sets the min-width of the component to 0. |
always-show-search | boolean | false | Shows the search input even when there are fewer than 8 options. |
search-hidden | boolean | false | Hides the search input even when there are more than 8 options. |
clear-visible | boolean | false | Shows a clear button. Requires a placeholder to be set. |
item-limit | number | 0 | Maximum number of visible items. Items over the limit only appear in search results. |
isReady | readonly boolean | — | Indicates whether the select is ready to open. |
JavaScript API
| Name | Kind | Description | |
|---|---|---|---|
open() | action | Opens the option list. | |
close() | action | Closes the option list. | |
Events
| Event | Description | Returns | |
|---|---|---|---|
change | Fires when the selected option changes. | Change event | |
search | Fires on input in the search field. | { detail: { value: string } } | |
open | Fires when the dropdown opens. | — | |
close | Fires when the dropdown closes. | — | |
ready | Fires when the component is ready to open. | — | |