qat

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

Example.qx22 lines, 2 reactive namesOpen in the playground
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 state

Add it

shell1 line
npx qatjs add combobox

Combobox

A searchable choice — one (`value`) or several (`multiple`, `values`, shown as chips). As a custom element: <ui-combobox>.

Combobox: props
PropTypeAttribute
labelQatNodeproperty only
helpQatNodeproperty only
errorQatNodeproperty only
requiredbooleanyes
disabledbooleanyes
size'sm' | 'md' | 'lg'yes
placeholderstringyes
optionsSelectOption[]property only
valuestringyes
valuesstring[]property only
multiplebooleanyes
maxChipsnumberyes
loadingbooleanyes
creatablebooleanyes
emptystringyes
Combobox: events
EventDetail
on:update:valueCustomEvent<string | undefined>
on:update:valuesCustomEvent<string[]>
on:createCustomEvent<string>

Keys

KeyDoes
↓ ↑open, move
Enterpick
Escclose
typingfilters
Backspaceremove the last chip (multiple)