Make your AI a shadcn expert

Shadcn Combobox

React combobox for searchable country and framework pickers. Built with TypeScript and Tailwind CSS for Next.js using Base UI — type to filter a long list.

A combobox is an input with a filterable list. Type a few letters, arrow to a row, Enter to pick it. Use it for countries, timezones, or frameworks — any closed set that is faster to search than to scroll.

Scroll to load preview...

Looking for a neobrutalism version for shadcn?

Same combobox, thicker borders. The NeoBrutalism combobox is the kit if you want that look.

Usage

import {
  Combobox,
  ComboboxContent,
  ComboboxEmpty,
  ComboboxInput,
  ComboboxItem,
  ComboboxList,
} from "@/components/ui/combobox"
const frameworks = ["Next.js", "SvelteKit", "Nuxt.js", "Remix", "Astro"]

<Combobox items={frameworks}>
  <ComboboxInput placeholder="Select a framework" />
  <ComboboxContent>
    <ComboboxEmpty>No items found.</ComboboxEmpty>
    <ComboboxList>
      {(item) => (
        <ComboboxItem key={item} value={item}>
          {item}
        </ComboboxItem>
      )}
    </ComboboxList>
  </ComboboxContent>
</Combobox>

items is the list. Pass a string[], or objects plus itemToStringValue.

Composition

A single-line input and a flat list.

ComboboxInput
ComboboxEmpty
ComboboxItem
ComboboxItem

Multi-select uses chips and ComboboxChipsInput.

ComboboxChip
ComboboxChipsInput

Groups nest ComboboxCollection inside each ComboboxGroup.

ComboboxInput
ComboboxEmpty
ComboboxLabel
ComboboxItem
ComboboxItem
ComboboxSeparator

Basic

A single-line input and a flat list of frameworks.

Scroll to load preview...

Multiple

multiple plus chips. Backspace removes the last chip.

Scroll to load preview...

Clear Button

showClear on ComboboxInput. It appears once something is selected.

Scroll to load preview...

Groups

ComboboxGroup plus ComboboxLabel, with a ComboboxSeparator between regions.

Scroll to load preview...

Custom Items

itemToStringValue when items are objects. The row can be an Item with a title and a description.

Scroll to load preview...

Invalid

aria-invalid on ComboboxInput. data-invalid on Field if the label should go red too.

Scroll to load preview...

Disabled

disabled on ComboboxInput greys the field and blocks the list.

Scroll to load preview...

Auto Highlight

autoHighlight highlights the first match as you type. Enter selects it.

Scroll to load preview...

render a Button as the trigger. Move ComboboxInput inside ComboboxContent.

Scroll to load preview...

Input Group

Drop an InputGroupAddon inside ComboboxInput — a globe, a kbd, whatever the field is.

Scroll to load preview...

RTL

Wrap with DirectionProvider and dir="rtl". Copy stays Arabic.

Scroll to load preview...

API

Prop

Type

ComboboxInput

Prop

Type

ComboboxContent

Prop

Type

ComboboxItem

Prop

Type

ComboboxChip takes showRemove. ComboboxEmpty, ComboboxGroup, ComboboxLabel, and ComboboxSeparator take className.

Keyboard

KeyAction
TypeFilter the list
ArrowDown / ArrowUpOpen the list. Next / previous item. Loops through the input
EnterSelect the highlighted item
EscapeClose the list
BackspaceOn chips, remove the last selected value
TabLeave the combobox

Notes

Objects need a string

itemToStringValue when items are objects. Skip it only if each item already has label (shown) and value (posted).

Chips need useComboboxAnchor on the field and anchor on ComboboxContent. The value must be one of items — type to filter, not to invent.

With other components

Questions

Was this page helpful?

Sign in to leave feedback.