Combobox

qds-combobox is an editable native form control for choosing a string identity from local or asynchronous suggestions. It uses the input as the focus target and a same-root, top-layer listbox. It imports shared form, option and overlay modules; it does not load the component catalog or a framework runtime.

Basic usage

<script type="module" src="/assets/components/combobox/qds-combobox.js"></script>
<qds-combobox id="owner" label="Deal owner" name="owner" required clearable></qds-combobox>
<script type="module">
  const owner = document.querySelector('#owner');
  owner.options = [{ value: 'usr-rivera', label: 'Alex Rivera', group: 'Investments', description: 'Houston' }];
  owner.value = 'usr-rivera';
</script>

Identity and editing

Asynchronous source

owner.suggestionProvider = async (query, { signal }) => {
  const response = await fetch(`/api/owners?q=${encodeURIComponent(query)}`, { signal });
  if (!response.ok) throw new Error('Directory unavailable');
  return response.json(); // Array of { value, label, disabled?, group?, description? }
};

Keyboard and accessibility

Forms and events

Demo and references