Combobox

A searchable select input that combines a text field with a filterable dropdown list.

Installation

pnpm dlx stera-ui add combobox

Usage

import {
  Combobox,
  ComboboxInput,
  ComboboxContent,
  ComboboxEmpty,
  ComboboxList,
  ComboboxItem,
} from "@/components/ui/combobox"
<Combobox items={items} itemToStringLabel={(item) => item.label}>
  <ComboboxInput placeholder="Select..." />
  <ComboboxContent>
    <ComboboxEmpty>No results found.</ComboboxEmpty>
    <ComboboxList>
      {(item) => (
        <ComboboxItem key={item.value} value={item}>
          {item.label}
        </ComboboxItem>
      )}
    </ComboboxList>
  </ComboboxContent>
</Combobox>

Multiple Selection

Pass multiple to allow selecting more than one item. Use ComboboxChips and ComboboxChipsInput for the chip-based input.

Groups

Use ComboboxCollection, ComboboxGroup, ComboboxLabel, and ComboboxSeparator to organise items into labelled sections.

Custom Items

Render any content inside ComboboxItem for rich layouts with icons and descriptions.

Use ComboboxTrigger with a Button and ComboboxValue for a traditional select-style popup trigger.

Invalid State

API Reference

Combobox

PropTypeDefault
itemsT[]
itemToStringLabel(item: T) => string
multiplebooleanfalse
valueT | T[]
defaultValueT | T[]
onValueChange(value: T | T[]) => void
autoHighlightbooleanfalse

ComboboxInput

PropTypeDefault
size"sm" | "md" | "lg" | "xl""md"
showClearbooleanfalse
showTriggerbooleantrue
disabledbooleanfalse