ToroUI

Combobox

An autocomplete input with a filterable dropdown list of options.


A composable combobox built on Base UI's Combobox primitive. Combines a text input with a popover list of options, supporting single and multi-select, chip-based multi-select, grouped options, and custom filtering.

"use client"

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

const frameworks = [
  { value: "next.js", label: "Next.js" },
  { value: "sveltekit", label: "SvelteKit" },
  { value: "nuxt.js", label: "Nuxt.js" },
  { value: "remix", label: "Remix" },
  { value: "astro", label: "Astro" },
]

export default function ComboboxDemo() {
  return (
    <Combobox>
      <ComboboxInput placeholder="Select framework..." />
      <ComboboxContent>
        <ComboboxList>
          <ComboboxEmpty>No framework found.</ComboboxEmpty>
          {frameworks.map((framework) => (
            <ComboboxItem key={framework.value} value={framework.value}>
              {framework.label}
            </ComboboxItem>
          ))}
        </ComboboxList>
      </ComboboxContent>
    </Combobox>
  )
}

Anatomy

import {
  Combobox,
  ComboboxInput,
  ComboboxContent,
  ComboboxList,
  ComboboxItem,
  ComboboxGroup,
  ComboboxLabel,
  ComboboxEmpty,
  ComboboxSeparator,
  ComboboxChips,
  ComboboxChip,
  ComboboxChipsInput,
  ComboboxTrigger,
  ComboboxValue,
  ComboboxCollection,
} from "@/components/ui/combobox"
<Combobox>
  <ComboboxInput placeholder="Search..." />
  <ComboboxContent>
    <ComboboxList>
      <ComboboxItem value="apple">Apple</ComboboxItem>
      <ComboboxItem value="banana">Banana</ComboboxItem>
      <ComboboxItem value="cherry">Cherry</ComboboxItem>
    </ComboboxList>
    <ComboboxEmpty>No results found.</ComboboxEmpty>
  </ComboboxContent>
</Combobox>

Examples

Basic combobox

<Combobox>
  <ComboboxInput placeholder="Select a fruit..." />
  <ComboboxContent>
    <ComboboxList>
      <ComboboxItem value="apple">Apple</ComboboxItem>
      <ComboboxItem value="banana">Banana</ComboboxItem>
      <ComboboxItem value="cherry">Cherry</ComboboxItem>
    </ComboboxList>
    <ComboboxEmpty>No results found.</ComboboxEmpty>
  </ComboboxContent>
</Combobox>

With groups

Use ComboboxGroup and ComboboxLabel to organize options into labeled sections.

<Combobox>
  <ComboboxInput placeholder="Search frameworks..." />
  <ComboboxContent>
    <ComboboxList>
      <ComboboxGroup>
        <ComboboxLabel>Frontend</ComboboxLabel>
        <ComboboxItem value="react">React</ComboboxItem>
        <ComboboxItem value="vue">Vue</ComboboxItem>
      </ComboboxGroup>
      <ComboboxSeparator />
      <ComboboxGroup>
        <ComboboxLabel>Backend</ComboboxLabel>
        <ComboboxItem value="express">Express</ComboboxItem>
        <ComboboxItem value="fastify">Fastify</ComboboxItem>
      </ComboboxGroup>
    </ComboboxList>
    <ComboboxEmpty>No frameworks found.</ComboboxEmpty>
  </ComboboxContent>
</Combobox>

Multi-select with chips

Use ComboboxChips, ComboboxChip, and ComboboxChipsInput for a tag-like multi-select experience.

<Combobox multiple>
  <ComboboxChips>
    {(value) => <ComboboxChip value={value}>{value}</ComboboxChip>}
    <ComboboxChipsInput placeholder="Add tags..." />
  </ComboboxChips>
  <ComboboxContent>
    <ComboboxList>
      <ComboboxItem value="react">React</ComboboxItem>
      <ComboboxItem value="vue">Vue</ComboboxItem>
      <ComboboxItem value="svelte">Svelte</ComboboxItem>
    </ComboboxList>
  </ComboboxContent>
</Combobox>

With clear button

Set showClear on ComboboxInput to display a clear button when a value is selected.

<Combobox>
  <ComboboxInput placeholder="Search..." showClear />
  <ComboboxContent>
    <ComboboxList>
      <ComboboxItem value="option-1">Option 1</ComboboxItem>
      <ComboboxItem value="option-2">Option 2</ComboboxItem>
    </ComboboxList>
  </ComboboxContent>
</Combobox>

API Reference

Combobox

A re-export of Base UI's Combobox.Root. Manages the combobox state including open/closed, selected value, and input value.

PropTypeDefaultDescription
multiplebooleanfalseWhether multiple items can be selected.
valuestring | string[]Controlled selected value.
onValueChange(value: string | string[]) => voidCallback when the selected value changes.
openbooleanControlled open state.
onOpenChange(open: boolean) => voidCallback when the popover opens or closes.
childrenReactNode

ComboboxInput

An input field wrapped in an InputGroup. Includes a built-in trigger chevron and optional clear button.

PropTypeDefaultDescription
showTriggerbooleantrueWhether to show the dropdown trigger chevron.
showClearbooleanfalseWhether to show a clear button when a value is selected.
disabledbooleanfalseWhether the input is disabled.
placeholderstringPlaceholder text.
classNamestring
childrenReactNode

ComboboxContent

The dropdown popover panel. Automatically renders inside a portal with a positioner.

PropTypeDefaultDescription
side"top" | "bottom" | "left" | "right""bottom"The preferred side of the anchor to render on.
sideOffsetnumber6Distance in pixels from the anchor.
align"start" | "center" | "end""start"Alignment along the anchor edge.
alignOffsetnumber0Offset for alignment.
anchorElement | RefObjectCustom anchor element for positioning.
classNamestring
childrenReactNode

ComboboxList

The scrollable list container for combobox items.

PropTypeDefault
classNamestring
childrenReactNode

ComboboxItem

A selectable option within the list. Renders a check icon when selected.

PropTypeDefaultDescription
valuestringRequired. The value of the item.
disabledbooleanfalseWhether the item is disabled.
classNamestring
childrenReactNode

ComboboxGroup

A grouping container for related combobox items.

PropTypeDefault
classNamestring
childrenReactNode

ComboboxLabel

A label rendered above a ComboboxGroup.

PropTypeDefault
classNamestring
childrenReactNode

ComboboxEmpty

A message displayed when no items match the search query.

PropTypeDefault
classNamestring
childrenReactNode

ComboboxSeparator

A horizontal divider between groups or items.

PropTypeDefault
classNamestring

ComboboxChips

A container that renders selected values as removable chips. Replaces ComboboxInput for multi-select layouts.

PropTypeDefault
classNamestring
childrenReactNode | (value: string) => ReactNode

ComboboxChip

A single chip representing a selected value inside ComboboxChips.

PropTypeDefaultDescription
valuestringThe selected value this chip represents.
showRemovebooleantrueWhether to show the remove button.
classNamestring
childrenReactNode

ComboboxChipsInput

A minimal text input for use inside ComboboxChips. Grows to fill available space.

PropTypeDefault
placeholderstring
classNamestring

ComboboxTrigger

A trigger element that opens the combobox popover. Renders a chevron-down icon.

PropTypeDefault
classNamestring
childrenReactNode

ComboboxValue

Displays the currently selected value text.

PropTypeDefault
classNamestring

ComboboxCollection

A virtual collection component for large datasets.

PropTypeDefault
childrenReactNode