qat

Listbox

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

Example

Courier: none

Example.qx19 lines, 1 reactive nameOpen in the playground
// <Listbox> is the list inside <Select>, <Combobox> and <CommandPalette>: it holds no focus,
// the control that opens it keeps it. Here, through a Combobox:
import { Combobox } from './ui/combobox/combobox.qx'

export default function Example() {
  let courier = state<string | undefined>(undefined)
  return (
    <Combobox
      label="Courier"
      options={[
        { value: 'azp', label: 'Azərpoçt' },
        { value: 'aze', label: 'AzərExpress' },
        { value: 'dhl', label: 'DHL', disabled: true },
      ]}
      bind:value={courier}
    />
    <p>Courier: {courier ?? 'none'}</p>
  )
}
courier state

Add it

shell1 line
npx qatjs add listbox

Listbox

The listbox: groups, options (the active one, the chosen ones), and the combobox's extra rows. As a custom element: <ui-listbox>.

Listbox: props
PropTypeAttribute
idstringyes
anchorElementproperty only
optionsSelectOption[]property only
activenumberyes
chosen(o: SelectOption) => booleanproperty only
pick(i: number) => voidproperty only
hover(i: number) => voidproperty only
close() => voidproperty only
multiplebooleanyes
labelstringyes
querystringyes
loadingbooleanyes
emptystringyes
createstringyes
inlinebooleanyes

Keys

KeyDoes
(none)it holds no focus: the control that opens it keeps its keys