Select
stable 4.2 kB<hk-select>Single or multi select with typeahead filtering. The trigger is a combobox and the panel a listbox, with the active option tracked by aria-activedescendant.
#dropdown#picker
In the package
npm i hellskitchen-ui Import hk-select and use it directly. Live demo
Running in this page — interact with it.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| value | unknown | unknown[] | null | Selected value, or array when [multiple]. Two-way bindable. |
| options | HkSelectChoice[] | string[] | [] | Choices ({ label, value }). Plain strings are accepted as shorthand. |
| multiple | boolean | false | Allows more than one selection; the trigger lists every chosen label. |
| filterable | boolean | false | Adds the typeahead box to the panel. |
| placeholder | string | 'Select' | Shown when nothing is chosen. |
| disabled | boolean | false | Blocks opening the panel. |
Outputs
valueChangeEventEmitter<unknown>Emits on selection.
opened / closedEventEmitter<void>Panel lifecycle, for lazy option loading.
Keyboard
- Space / Enter Opens the panel, or picks the active option
- ↑ / ↓ Moves the active option
- Home / End First / last option
- Escape Closes without changing the value
- Type a letter Jumps to the next option starting with it
Theming
Component tokens, each falling back to a global one:
| Property | Default | Controls |
|---|---|---|
| --hk-select-panel-bg | #ffffff | Trigger and dropdown background. |
| --hk-select-option-hover | #f1f5f9 | Hovered and active option wash. |
| --hk-select-max-height | 11rem | Panel height before it scrolls. |
Accessibility
- Implements the listbox pattern: the trigger is a combobox, the panel a listbox, and aria-activedescendant tracks the active option without moving DOM focus.
- Selected state is exposed through aria-selected, never through colour alone.