Combobox
Combobox. It is copied into your app’s ui/ by qatjs add combobox: the code is yours to edit.
Example
AzərpoçtDHL
Couriers: azp, dhl; one: none
import { Combobox } from './ui/combobox/combobox.qx'
const couriers = [
{ value: 'azp', label: 'Azərpoçt', group: 'Baku' },
{ value: 'aze', label: 'AzərExpress', group: 'Baku' },
{ value: 'dhl', label: 'DHL', group: 'International' },
{ value: 'ups', label: 'UPS', group: 'International' },
]
export default function Example() {
let tags = state(['azp', 'dhl'])
let courier = state<string | undefined>(undefined)
return (
<div class="example-grid">
<Combobox label="Couriers" multiple options={couriers} bind:values={tags} />
<Combobox label="Courier" options={couriers} bind:value={courier} />
</div>
<p>
Couriers: {tags.join(', ')}; one: {courier ?? 'none'}
</p>
)
}tags statecourier stateAdd it
npx qatjs add comboboxCombobox
A searchable choice — one (`value`) or several (`multiple`, `values`, shown as chips). As a custom element: <ui-combobox>.
| 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 |
values | string[] | property only |
multiple | boolean | yes |
maxChips | number | yes |
loading | boolean | yes |
creatable | boolean | yes |
empty | string | yes |
| Event | Detail |
|---|---|
on:update:value | CustomEvent<string | undefined> |
on:update:values | CustomEvent<string[]> |
on:create | CustomEvent<string> |
Keys
| Key | Does |
|---|---|
| ↓ ↑ | open, move |
| Enter | pick |
| Esc | close |
| typing | filters |
| Backspace | remove the last chip (multiple) |