Component
Select
A native select over an `Option[]`.
import { Select } from '@loidolt/theme-svelte';
Example
Value: unset
Notes
- The placeholder stays selectable unless the field is
required. - Pass
{ label, options }entries to group options under native<optgroup>headings.
Props
Generated from the component source, so it cannot drift from the implementation.
| Prop | Type | Default | Notes |
|---|---|---|---|
options required | OptionEntry<T>[] | — | Options, optionally in labelled groups — rendered as native <optgroup>s. |
boxed | boolean | false | Draws the full box instead of the default underline. |
class | string | — | |
label | string | — | Accessible name when the select is not wrapped in a Field or <label>. |
onValueChange | (value: T | '') => void | — | |
placeholder | string | — | Empty-choice text. Selectable again after a real choice unless the field is required, so a user can undo their selection. |
ref bindable | HTMLSelectElement | null | null | |
value bindable | T | '' | '' |
Plus the attributes of Omit<HTMLSelectAttributes, 'value'>, forwarded to the root element.