Combobox

An autocomplete input component that allows users to select from a filterable list of options with support for single and multi-select.

Overview

The Combobox component provides an accessible autocomplete input that combines a text input with a filterable dropdown list. It supports both single and multi-select modes, grouped options, custom rendering, and creatable items. Built on Base UI primitives, it offers full keyboard navigation and accessibility features.

Usage

import {
  Combobox,
  ComboboxChips,
  ComboboxClear,
  ComboboxContent,
  ComboboxIcon,
  ComboboxInput,
  ComboboxItem,
  ComboboxItemIndicator,
  ComboboxList,
  ComboboxValue,
  ComboboxWrapper,
} from "@tilt-legal/cubitt-components/combobox";
// Basic single select
<Combobox items={options}>
  <ComboboxWrapper>
    <ComboboxInput placeholder="Select an option..." />
    <ComboboxClear />
    <ComboboxIcon />
  </ComboboxWrapper>

  <ComboboxContent>
    <ComboboxEmpty>No results found.</ComboboxEmpty>
    <ComboboxList>
      {(item) => (
        <ComboboxItem value={item}>
          <ComboboxItemIndicator />
          {item.label}
        </ComboboxItem>
      )}
    </ComboboxList>
  </ComboboxContent>
</Combobox>

Examples

Multi-Select with Chips

Display selected items as removable chips within the input.

Need users to create new tags on the fly? Use the TagInput component which provides a simpler API with built-in support for creating tags via Enter/comma, CSV paste parsing, and backspace removal.

Multi-Select with Separate Input

Use a separate input field with chips displayed below.

Button Trigger with Popup Input

Use a button trigger with the input inside the popup.

Light Content Variant

Use variant="light" when the popup sits on a lighter surface and should use bg-bg-2 with softer highlighted states.

Grouped Options

Organize options into labeled groups.

Size Variants

The combobox input supports three size variants: sm, md (default), and lg.

Indicator Position

The indicator position can be changed to left or right.

URL State (Single Select)

Sync a single selection with the URL. Try selecting a category and refreshing the page.

URL State (Multi-Select)

Sync multiple selections with the URL using comma-separated values.

Props

Combobox

PropTypeDefaultDescription
itemsT[]—The list of items to display in the combobox.
multiplebooleanfalseEnable multi-select mode.
valueT | T[]—The controlled value(s).
defaultValueT | T[]—The default value(s) when uncontrolled.
onValueChange(value: T | T[]) => void—Callback when the selection changes.
inputValuestring—The controlled input text value.
onInputValueChange(value: string) => void—Callback when the input text changes.
onOpenChange(open: boolean, details) => void—Callback when the popup open state changes.
disabledbooleanfalseDisable the combobox.
indicatorPosition"left" | "right""right"Position of the selection indicator in items.
classNamestring—Additional CSS classes for the combobox.

URL State Props

When provided with a paramName, the combobox will sync its selection with URL parameters via TanStack Router search params.

PropTypeDefaultDescription
paramNamestring—URL parameter name for syncing state with URL. Enables URL state management.
onUrlValueChange(value: T | T[] | null) => void—Callback when URL parameter value changes.
paramClearOnDefaultbooleantrueRemove URL param when value equals default.
paramThrottlenumber—Throttle URL updates in milliseconds.
paramDebouncenumber—Debounce URL updates in milliseconds.
itemToStringValue(item: T) => string—Function to extract string value from item for URL serialization. Auto-detects common ID fields if not provided.

ComboboxInput

PropTypeDescription
size"sm" | "md" | "lg"The size variant of the input.
placeholderstringPlaceholder text for the input.
classNamestringAdditional CSS classes.

ComboboxItem

PropTypeDescription
valueTThe value this item represents.
classNamestringAdditional CSS classes.

ComboboxChips

PropTypeDescription
size"sm" | "md" | "lg"The size variant matching the input.
classNamestringAdditional CSS classes.

ComboboxWrapper

A wrapper component that provides input styling and serves as the positioning anchor for the popup. Uses the same styles as InputWrapper for consistency.

PropTypeDescription
size"sm" | "md" | "lg"The size variant matching the input.
classNamestringAdditional CSS classes.

ComboboxContent

PropTypeDefaultDescription
variant"default" | "light""default"Controls popup and highlighted styling.
classNamestring—Additional CSS classes.

ComboboxList

PropTypeDescription
classNamestringAdditional CSS classes.

ComboboxEmpty

PropTypeDescription
classNamestringAdditional CSS classes.

ComboboxGroup

PropTypeDescription
classNamestringAdditional CSS classes.

ComboboxGroupLabel

PropTypeDescription
classNamestringAdditional CSS classes.

ComboboxItemIndicator

PropTypeDescription
classNamestringAdditional CSS classes.

ComboboxChip

PropTypeDescription
classNamestringAdditional CSS classes.

ComboboxChipRemove

PropTypeDescription
classNamestringAdditional CSS classes.

ComboboxValue

PropTypeDescription
childrenReactNode | ((value: T | T[]) => ReactNode)Content or render function for displaying value.
classNamestringAdditional CSS classes.

ComboboxIcon

PropTypeDescription
classNamestringAdditional CSS classes.

ComboboxClear

Uses Base UI's data-visible state so the clear affordance only appears when there is a clearable value.

PropTypeDescription
classNamestringAdditional CSS classes.

ComboboxTrigger

PropTypeDescription
classNamestringAdditional CSS classes.

On this page