- Accordion
- Action Bar
- Action Toast
- Alert Banner
- Alert Dialog
- Alert
- Alphabet Index
- Amount Field
- Aspect Ratio
- Attachment
- Availability List
- Avatar
- Badge
- Bank Card
- Breadcrumb
- Bubble
- Button Group
- Button
- Calendar
- Camera Frame
- Card Design Picker
- Card Details
- Card Peek
- Card Stack
- Card
- Carousel
- Chart
- Chat Thread
- Checkbox
- Chip Group
- Choice Tile
- Code Block
- Code Dots
- Collapsible
- Combobox
- Command
- Context Menu
- Copy Field
- Countdown
- Country Select
- Data Table
- Date Field
- Date Picker
- Date Range Picker
- Dialog
- Direction
- Document Paper
- Drawer
- Dropdown Menu
- Empty
- Entity Avatar
- Field
- File Trigger
- File Upload Item
- Hover Card
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Key Value
- Keypad
- Label
- Live Region
- Marker
- Message Scroller
- Message
- Money Amount
- Native Select
- Number Field
- Pagination
- Percent Split Editor
- Phone Field
- Popover
- Progress
- QR Code
- Questionnaire
- Radio Group
- Range Histogram
- Rating
- Resizable
- Scroll Area
- Search Field
- Select
- Separator
- Share Bar
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Sortable List
- Spinner
- Status Timeline
- Step Header
- Steps List
- Swipe Row
- Switch
- Table
- Tabs
- Text Field
- Textarea
- Tier Ladder
- Toggle Group
- Toggle
- Token Search Field
- Tooltip
- Trace
- Transaction Row
- Usage Meter
"use client"
import {
Installation#
pnpm dlx shadcn@latest add @dots/combobox
Usage#
import {
Combobox,
ComboboxContent,
ComboboxEmpty,
ComboboxInput,
ComboboxItem,
ComboboxList,
} from "@/components/ui/combobox"const frameworks = ["Next.js", "SvelteKit", "Nuxt.js", "Remix", "Astro"]
export function ExampleCombobox() {
return (
<Combobox allowsEmptyCollection>
<ComboboxInput placeholder="Select a framework" />
<ComboboxContent>
<ComboboxList
renderEmptyState={() => (
<ComboboxEmpty>No items found.</ComboboxEmpty>
)}
>
{frameworks.map((item) => (
<ComboboxItem key={item} id={item}>
{item}
</ComboboxItem>
))}
</ComboboxList>
</ComboboxContent>
</Combobox>
)
}Composition#
Simple#
A single-line input and a flat list (see Basic).
Combobox
├── ComboboxInput
└── ComboboxContent
└── ComboboxList
├── ComboboxItem
└── ComboboxItemWith chips#
Multi-select with multiple, chips, and a chips input (see Multiple).
Combobox
├── ComboboxChips
│ ├── ComboboxChipList
│ │ └── ComboboxChip
│ └── ComboboxChipsInput
└── ComboboxContent
└── ComboboxList
├── ComboboxItem
└── ComboboxItemWith groups and collection#
Nested items per group using ComboboxGroup, with a separator between groups (see Groups).
Combobox
├── ComboboxInput
└── ComboboxContent
└── ComboboxList
├── ComboboxGroup
│ ├── ComboboxLabel
│ ├── ComboboxItem
│ └── ComboboxItem
├── ComboboxSeparator
└── ComboboxGroup
├── ComboboxLabel
├── ComboboxItem
└── ComboboxItemCustom Items#
Use textValue when your items render JSX children.
import * as React from "react"
import {
Combobox,
ComboboxContent,
ComboboxEmpty,
ComboboxInput,
ComboboxItem,
ComboboxList,
} from "@/components/ui/combobox"
type Framework = {
label: string
value: string
}
const frameworks: Framework[] = [
{ label: "Next.js", value: "next" },
{ label: "SvelteKit", value: "sveltekit" },
{ label: "Nuxt", value: "nuxt" },
]
export function ExampleComboboxCustomItems() {
return (
<Combobox allowsEmptyCollection>
<ComboboxInput placeholder="Select a framework" />
<ComboboxContent>
<ComboboxList
renderEmptyState={() => (
<ComboboxEmpty>No items found.</ComboboxEmpty>
)}
items={frameworks}
>
{(framework) => (
<ComboboxItem id={framework.value} textValue={framework.label}>
<span>{framework.label}</span>
</ComboboxItem>
)}
</ComboboxList>
</ComboboxContent>
</Combobox>
)
}Multiple Selection#
Use multiple with chips for multi-select behavior.
import * as React from "react"
import {
Combobox,
ComboboxChip,
ComboboxChipList,
ComboboxChips,
ComboboxChipsInput,
ComboboxContent,
ComboboxEmpty,
ComboboxInput,
ComboboxItem,
ComboboxList,
} from "@/components/ui/combobox"
const frameworks = ["Next.js", "SvelteKit", "Nuxt.js", "Remix", "Astro"]
export function ExampleComboboxMultiple() {
const [value, setValue] = React.useState<string[]>([])
return (
<Combobox
selectionMode="multiple"
value={value}
onChange={setValue}
allowsEmptyCollection
>
<ComboboxChips>
<ComboboxChipList<{ name: string }>>
{(value) => <ComboboxChip id={value.name}>{value.name}</ComboboxChip>}
</ComboboxChipList>
<ComboboxChipsInput placeholder="Add framework" />
</ComboboxChips>
<ComboboxContent>
<ComboboxList
renderEmptyState={() => (
<ComboboxEmpty>No items found.</ComboboxEmpty>
)}
>
{frameworks.map((item) => (
<ComboboxItem key={item} id={item}>
{item}
</ComboboxItem>
))}
</ComboboxList>
</ComboboxContent>
</Combobox>
)
}Basic#
A simple combobox with a list of frameworks.
"use client"
import {
Multiple#
A combobox with multiple selection using multiple and ComboboxChips.
"use client"
import * as React from "react"
Clear Button#
Use the showClear prop to show a clear button.
"use client"
import {
Groups#
Use ComboboxGroup and ComboboxSeparator to group items.
"use client"
import {
Custom Items#
You can render custom component inside ComboboxItem.
"use client"
import {
Invalid#
Use the isInvalid prop to make the combobox invalid.
"use client"
import {
Disabled#
Use the isDisabled prop to disable the combobox.
"use client"
import {
Input Group#
You can add an addon to the combobox by using the InputGroupAddon component inside the ComboboxInput.
"use client"
import { GlobeIcon } from "lucide-react"
API Reference#
See the React Aria documentation for more information.