Combo Box

A text field that filters a menu of choices as you type.

@cupertinoui/comboboxBase UI Combobox Registry JSON

Installation

pnpm dlx shadcn@latest add @cupertinoui/combobox

The first install also adds the macOS theme. See Installation to set up the registry.

Usage

import { Combobox, ComboboxContent, ComboboxInput, ComboboxItem, ComboboxList } from "@/components/ui/combobox"

<Combobox items={cities}>
  <ComboboxInput placeholder="Choose a city" />
  <ComboboxContent>
    <ComboboxList>
      {(city) => <ComboboxItem key={city} value={city}>{city}</ComboboxItem>}
    </ComboboxList>
  </ComboboxContent>
</Combobox>

API Reference

Every part forwards the props of the underlying Base UI Combobox part. The props below are the ones CupertinoUI adds or changes.

Combobox

PropTypeDescription
itemsT[]The choices; ComboboxList renders each with a function.
value / onValueChangeTThe chosen item.
multipleboolean
Default: false
Chips for several choices (ComboboxChips).
classNamestringExtra classes, merged with the component's own.

ComboboxInput

PropTypeDescription
showTrigger / showClearbooleanShow the menu button, or a clear button.
classNamestringExtra classes, merged with the component's own.