Skip to content

Combobox

An accessible typeable autocomplete with consumer-driven filtering.

Styled with CSS Tailwind

Basic Combobox

Type to filter, use Up / Down to navigate, Enter to select, Escape to close. The combobox emits an OnQueryChange event; you do the filtering in your own code and pass only the matching options as children.

Selected: (none)

Multi-select with chips

Set Multiple="true" to allow many selections. Selected values are shown as chips before the input (each with a remove button). The panel stays open after each pick.

Picked: (none)

Creatable values and a clear button

With CreateValue, Enter on text that matches no option makes a new value of it and raises OnCreate - add it to your options there. A BitBhComboboxClear empties the value and the text and puts the focus back in the input; it is named "Clear", out of the tab order (Escape does the same) and disabled while there is nothing to clear.

Label: (none)

Object values with rich content

Bind to objects rather than strings. Provide a DisplayValue function that converts the selected object back to the input text, and render rich content inside each option.

Selected: (none)

Anchor Positioning

Set Anchor on BitBhComboboxOptions to automatically position the dropdown relative to the input using position: fixed. The panel flips to the opposite side when there's not enough space, shifts to stay within the viewport, and auto-updates on scroll/resize. No position: relative on the parent is needed.

Bottom Start

Top Start (flips down if no space)

Selected: (none)

Large lists (virtualized)

Pass the matching data to BitBhComboboxOptions through Items with an ItemTemplate, and set Virtualize="true" so only the options in view are rendered in a scrollable panel. Every option must be exactly ItemSize tall (36px here): the CSS version sizes the generated [role="option"] elements, the Tailwind version gives the template's content h-9. Filtering stays yours: OnQueryChange runs BitBhFilter.Contains — case- and accent-insensitive — over 10,000 items on every keystroke. Child content such as BitBhComboboxEmpty still renders after the data options; it shows only while nothing matches.

10,000 matches · Selected: (none)

Options of different heights (virtualized)

With VariableItemSize="true" the options of a virtualized panel can differ in height - here each article shows an excerpt of one to three lines. Every option is measured as it renders and again when it resizes; ItemSize (60px here) is only the estimate for the options not rendered yet, and a new query starts over with the matches it found. The scroll position holds still as measurements arrive, and the arrow keys and Page Up / Page Down keep the highlighted option fully in view.

3,000 matches · Selected: (none)
An unhandled error has occurred. Reload 🗙