About the shadcn/ui Combobox Component

The Combobox component is part of shadcn/ui — a collection of accessible, copy-paste React components built with Radix UI and Tailwind CSS. Install it with `npx shadcn@latest add combobox` and copy it directly into your project.

Combobox Component — Frequently Asked Questions

How do I load async options in shadcn Combobox?

Use an async fetch inside the Popover's `onOpenChange`: when opened, call your API, set options state, and render them as `<CommandItem>` elements.

How do I allow creating new items in a shadcn Combobox?

Add a `<CommandItem value="create">` at the bottom showing the typed input. On select, add the new item to your options array and select it.

How do I use Combobox for multi-select?

Manage a `string[]` of selected values. In `onSelect`, toggle items: `setValues(prev => prev.includes(val) ? prev.filter(v => v !== val) : [...prev, val])`. Show checkmarks for selected items.

Combobox Component - shadcn/ui Examples | Shadcn Store