Select
Select. It is copied into your app’s ui/ by qatjs add select: the code is yours to edit.
Example
Region: none
import { Select } from './ui/select/select.qx'
export default function Example() {
let region = state<string | undefined>(undefined)
return (
<div class="example-grid">
<Select
label="Region"
placeholder="Choose a region"
options={[
{ value: 'bak', label: 'Baku' },
{ value: 'gan', label: 'Ganja' },
{ value: 'sum', label: 'Sumgait' },
]}
bind:value={region}
/>
</div>
<p>Region: {region ?? 'none'}</p>
)
}region stateAdd it
npx qatjs add selectSelect
One choice from a list; the trigger is a button (select-only combobox). As a custom element: <ui-select>.
| Prop | Type | Attribute |
|---|---|---|
label | QatNode | property only |
help | QatNode | property only |
error | QatNode | property only |
required | boolean | yes |
disabled | boolean | yes |
size | 'sm' | 'md' | 'lg' | yes |
placeholder | string | yes |
options | SelectOption[] | property only |
value | string | yes |
| Event | Detail |
|---|---|
on:update:value | CustomEvent<string> |
Keys
| Key | Does |
|---|---|
| ↓ ↑ | open, move |
| Home, End | the first, the last |
| Enter | pick |
| Esc | close |
| typing | jumps to an option |