Combobox

Preview

Workspace

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/combobox

API Reference

ComboboxContent

side?
"bottom" | "top"
Defaultbottom
align?
"start" | "end" | "center"
Defaultstart
sideOffset?
number
Default6
avoidCollisions?
boolean
Defaulttrue
className?
string
Default—

Combobox

value?
string
Default—
defaultValue?
string
Default—
onValueChange?
((value: string) => void)
Default—
open?
boolean
Default—
defaultOpen?
boolean
Defaultfalse
onOpenChange?
((open: boolean) => void)
Default—
query?
string
Default—
defaultQuery?
string
Default
onQueryChange?
((query: string) => void)
Default—
filter?
ComboboxFilter
Default(value, query, keywords) => { const needle = query.trim().toLocaleLowerCase(); if (!needle) return true; const haystack = [value, ...keywords].join(" ").toLocaleLowerCase(); let queryIndex = 0; for (const character of haystack) { if (character === needle[queryIndex]) queryIndex += 1; if (queryIndex === needle.length) return true; } return false; }
disabled?
boolean
Defaultfalse
className?
string
Default—

ComboboxEmpty

className?
string
Default—

ComboboxGroup

className?
string
Default—

ComboboxItem

value
string
Default—
textValue?
string
Default—
keywords?
string[]
Default[]
disabled?
boolean
Defaultfalse
onSelect?
((value: string) => void)
Default—
className?
string
Default—

ComboboxLabel

className?
string
Default—

ComboboxList

ariaLabel?
string
DefaultOptions
className?
string
Default—

ComboboxSeparator

className?
string
Default—

ComboboxInput

ref?
Ref<HTMLInputElement>
Default—
wrapperClassName?
string
Default—
className?
string
Default—

ComboboxTrigger

className?
string
Default—

ComboboxValue

placeholder?
ReactNode
DefaultSelect an option
className?
string
Default—

Composition

Place the searchable input inside the trigger, then compose listbox primitives inside the portalled content.

Combobox
├── ComboboxTrigger
│   └── ComboboxInput
└── ComboboxContent
    └── ComboboxList
        ├── ComboboxEmpty
        ├── ComboboxGroup
        │   ├── ComboboxLabel
        │   └── ComboboxItem
        └── ComboboxSeparator

How it works

A combobox combines text input with a filtered listbox while keeping focus in the input. It manages search, active-option navigation, selection, and portal positioning without owning the option data or surrounding form.

Updated