qat

Select

Select. It is copied into your app’s ui/ by qatjs add select: the code is yours to edit.

Example

Region: none

Example.qx20 lines, 1 reactive nameOpen in the playground
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 state

Add it

shell1 line
npx qatjs add select

Select

One choice from a list; the trigger is a button (select-only combobox). As a custom element: <ui-select>.

Select: props
PropTypeAttribute
labelQatNodeproperty only
helpQatNodeproperty only
errorQatNodeproperty only
requiredbooleanyes
disabledbooleanyes
size'sm' | 'md' | 'lg'yes
placeholderstringyes
optionsSelectOption[]property only
valuestringyes
Select: events
EventDetail
on:update:valueCustomEvent<string>

Keys

KeyDoes
↓ ↑open, move
Home, Endthe first, the last
Enterpick
Escclose
typingjumps to an option