Skip to content
Components

Combobox

Searchable input with a dropdown listbox. Filters options as you type, navigable with arrow keys.

New Keyboard Screen reader Evergreen
  • React
  • Vue
  • Svelte
  • Solid
  • Astro
  • Qwik
html
<div class="b-combobox">
  <input class="b-input" placeholder="Choose…">
  <ul class="b-combobox-list">
    <li class="b-combobox-option" data-value="A">A</li>
    <li class="b-combobox-option" data-value="B">B</li>
  </ul>
</div>

Behavior (with autoInit())

  • Typing filters the listbox
  • Arrow Down/Up navigate, Home/End jump to the first and last option
  • Enter selects the active option
  • Escape closes
  • Click selects

autoInit() also wires up the ARIA: the input becomes role="combobox" with aria-controls and aria-expanded, the list becomes role="listbox", and each option gets role="option" plus a generated id. As you arrow through, the active option's id is written to aria-activedescendant on the input — DOM focus never leaves the input, so this is what makes the current option announced. Options you supply with your own id keep it.

Listening for selection

js
document.addEventListener("b:combobox:select", (e) => {
  console.log("Selected:", e.detail.value);
});

API

ClassEffect
.b-comboboxWrapper
.b-combobox-listThe listbox <ul>
.b-combobox-optionEach option <li>
data-value="..."The value to set on the input
Edit this page