Skip to content

Components

Combobox

A text input that filters a list of options as you type.

Usage

Basic

HTML
<bs:bsui-combobox placeholder="Pick a framework">
  <bs:bsui-combobox-input />
  <bs:bsui-combobox-popup>
    <bs:bsui-combobox-option value="wordpress" label="WordPress" />
    <bs:bsui-combobox-option value="astro" label="Astro" />
    <bs:bsui-combobox-option value="laravel" label="Laravel" />
  </bs:bsui-combobox-popup>
</bs:bsui-combobox>

Long list

Typing filters the options, which is what a combobox buys you over a select.

HTML
<bs:bsui-combobox name="timezone" placeholder="Search time zones">
  <bs:bsui-combobox-input />
  <bs:bsui-combobox-popup>
    <bs:bsui-combobox-option value="lisbon" label="Lisbon" />
    <bs:bsui-combobox-option value="london" label="London" />
    <bs:bsui-combobox-option value="berlin" label="Berlin" />
    <bs:bsui-combobox-option value="helsinki" label="Helsinki" />
    <bs:bsui-combobox-option value="istanbul" label="Istanbul" />
    <bs:bsui-combobox-option value="dubai" label="Dubai" />
    <bs:bsui-combobox-option value="singapore" label="Singapore" />
    <bs:bsui-combobox-option value="tokyo" label="Tokyo" />
    <bs:bsui-combobox-option value="sydney" label="Sydney" />
  </bs:bsui-combobox-popup>
</bs:bsui-combobox>

In a field

A name submits the chosen value, while the visible text stays the label.

Only people with access to this project are listed.
HTML
<bs:bsui-field>
  <bs:bsui-field-label text="Assignee" />
  <bs:bsui-combobox name="assignee" placeholder="Search teammates">
    <bs:bsui-combobox-input />
    <bs:bsui-combobox-popup>
      <bs:bsui-combobox-option value="ada" label="Ada Lovelace" />
      <bs:bsui-combobox-option value="grace" label="Grace Hopper" />
      <bs:bsui-combobox-option value="alan" label="Alan Turing" />
    </bs:bsui-combobox-popup>
  </bs:bsui-combobox>
  <bs:bsui-field-description text="Only people with access to this project are listed." />
</bs:bsui-field>

Anatomy

Combobox is composed of the blocks below. Each one is a separate block that only renders inside its parent.

  • bsui/combobox
  • bsui/combobox-input
  • bsui/combobox-popup
  • bsui/combobox-option

Attributes

AttributeTypeDefault
placeholder text Search...
name text —

bsui/combobox-input

This block takes no attributes.

bsui/combobox-popup

This block takes no attributes.

bsui/combobox-option

AttributeTypeDefault
value text —
label text —