Skip to content

Combobox

Autocomplete input and command palette with a list of suggestions.

Install

Bash
npx @madeui/cli add combobox

Usage

TSX
import {
  Combobox,
  ComboboxContent,
  ComboboxEmpty,
  ComboboxInput,
  ComboboxItem,
  ComboboxList,
} from '@/components/ui/combobox';

Composition

Simple

A single-line input and a flat list.

TSX
<Combobox items={items}>
  <ComboboxInput />
  <ComboboxContent>
    <ComboboxEmpty />
    <ComboboxList>
      {(item) => <ComboboxItem value={item} />}
    </ComboboxList>
  </ComboboxContent>
</Combobox>

With chips

Multi-select with multiple, chips, and a chips input. ComboboxChips also serves as the popup anchor — pass a ref to ComboboxContent’s anchor.

TSX
<Combobox items={items} multiple value={value} onValueChange={setValue}>
  <ComboboxChips ref={anchorRef}>
    <ComboboxValue>
      {(values) => values.map((value) => <ComboboxChip key={value}>{value}</ComboboxChip>)}
    </ComboboxValue>
    <ComboboxChipsInput />
  </ComboboxChips>
  <ComboboxContent anchor={anchorRef}>
    <ComboboxEmpty />
    <ComboboxList>
      {(item) => <ComboboxItem value={item} />}
    </ComboboxList>
  </ComboboxContent>
</Combobox>

Multiple

Use multiple with ComboboxChips for multi-select. Selected values render as removable chips inline with the input.

Trigger the combobox from a button-like ComboboxTrigger instead of an always-visible input — move ComboboxInput inside ComboboxContent with showTrigger={false}.

Clear

Use showClear on ComboboxInput to show a button that clears the value.

Groups

Use ComboboxGroup, ComboboxLabel, ComboboxCollection, and ComboboxSeparator to group related items.

Custom items

Use itemToStringValue when items are objects, and render any content inside ComboboxItem.

Disabled

Auto highlight

Use autoHighlight to highlight the first matching item automatically while filtering.

API reference

Built on Base UI Combobox. Pass items to the root and it filters as you type out of the box; ComboboxList accepts a render function over the filtered items. All other props are forwarded to the underlying Base UI parts (multiple, value, onValueChange, itemToStringValue, autoHighlight, custom filter, …); see the Base UI Combobox API reference.

ComboboxInput

Text input with a built-in dropdown trigger button.

PropTypeDefaultDescription
showTriggerbooleantrueRender the built-in dropdown trigger button. Set false when the input lives inside ComboboxContent and a ComboboxTrigger elsewhere anchors the popup.
showClearbooleanfalseRender a clear button (Base UI Clear) before the trigger.
styleStyleXStyles—StyleX styles merged last — always win over the component’s own styles, applied to the wrapper.

ComboboxContent

PropTypeDefaultDescription
side'top' | 'right' | 'bottom' | 'left''bottom'
sideOffsetnumber6
align'start' | 'center' | 'end''start'
alignOffsetnumber0
anchorElement | RefObject<Element | null> | (() => Element)—Positions the popup against an element other than the input/trigger, e.g. ComboboxChips.
styleStyleXStyles—StyleX styles merged last — always win over the component’s own styles.

Styling

ComboboxTrigger (select-like popup trigger button), ComboboxChips (chips container, also usable as a popup anchor), ComboboxChip (pill with a built-in remove button), and ComboboxChipsInput (borderless input for inline use inside ComboboxChips) all accept style (StyleXStyles, merged last so caller overrides always win) plus all native props of the element they render.

ComboboxGroup, ComboboxLabel, ComboboxValue, and ComboboxCollection are also exported for grouped and multi-part lists.

Was this page helpful?