Skip to content
Drivn

Combobox

Searchable select with filtering, single and multi selection, and full keyboard navigation. Powered by cmdk.

Preview

Installation

npx drivn add combobox

Usage

1import { useState } from "react"
2import { Combobox } from "@/components/ui/combobox"
3
4const frameworks = [
5 { label: "React", value: "react" },
6 { label: "Vue", value: "vue" },
7 { label: "Angular", value: "angular" },
8 { label: "Svelte", value: "svelte" },
9 { label: "Next.js", value: "nextjs" },
10]
11
12export default function Page() {
13 const [value, setValue] = useState("")
14
15 return (
16 <Combobox value={value} onChange={setValue}>
17 <Combobox.Trigger placeholder="Select framework...">
18 {frameworks.find(f => f.value === value)?.label}
19 </Combobox.Trigger>
20 <Combobox.Content placeholder="Search frameworks...">
21 <Combobox.Empty />
22 {frameworks.map(f => (
23 <Combobox.Item key={f.value} value={f.value}>
24 {f.label}
25 </Combobox.Item>
26 ))}
27 </Combobox.Content>
28 </Combobox>
29 )
30}

Multi Select

With Groups

Clearable

With Icons

Disabled Items

Custom Empty State

API Reference

Combobox

PropTypeDefaultDescription
valuestring | string[]—Controlled value. String for single, string[] for multi
onChange(value: string | string[]) => void—Callback when the selected value changes
multiplebooleanfalseEnable multi-select mode with tag chips
classNamestring—Additional CSS classes for the root element

Combobox.Trigger

PropTypeDefaultDescription
placeholderstring"Select..."Text shown when no value is selected
clearablebooleanfalseShow a clear button (X) instead of chevron when a value is selected
childrenReactNode—Custom display for the selected value (single mode)
classNamestring—Additional CSS classes for the trigger

Combobox.Content

PropTypeDefaultDescription
placeholderstring"Search..."Placeholder text for the search input
childrenReactNode—Combobox items, groups, empty, and separators
classNamestring—Additional CSS classes for the dropdown content

Combobox.Item

PropTypeDefaultDescription
valuestring—Unique value for the item
iconComponentType | ReactElement—Icon component or element displayed before the label
disabledbooleanfalseWhether the item is disabled
childrenReactNode—Label content for the item
classNamestring—Additional CSS classes for the item

Combobox.Group

PropTypeDefaultDescription
headingstring—Group heading displayed above the items
childrenReactNode—Combobox items within the group
classNamestring—Additional CSS classes for the group

Combobox.Label

PropTypeDefaultDescription
childrenReactNode—Label text content
classNamestring—Additional CSS classes for the label

Combobox.Empty

PropTypeDefaultDescription
childrenReactNode"No results found."Custom content for the empty state
classNamestring—Additional CSS classes for the empty state

Combobox.Separator

PropTypeDefaultDescription
classNamestring—Additional CSS classes for the separator