Combobox
A searchable select input with autocomplete functionality.
Made by eblairmckeePowered by
Installation
Loading component...
When to use
Use this decision tree to determine when to use the Combobox component:
Usage
import { Combobox } from "@/components/ui/combobox""use client"
import React from "react"
import { Combobox } from "@/components/ui/combobox"
const frameworks = [
{
value: "next.js",
label: "Next.js",
},
{
value: "sveltekit",
label: "SvelteKit",
},
{
value: "nuxt.js",
label: "Nuxt.js",
},
{
value: "remix",
label: "Remix",
},
{
value: "astro",
label: "Astro",
},
]
export function ComboboxDemo() {
const [value, setValue] = React.useState("")
return (
<Combobox
options={frameworks}
value={value}
onChange={setValue}
placeholder="Select framework..."
/>
)
}Props
Combobox
Prop
Type
Examples
Basic Combobox
Loading component...
Form Integration
Loading component...
Creatable Options
Loading component...
Disabled State
Loading component...
Grouped Combobox
Loading component...
Timezone Picker
Loading component...
Async Remote Search
Loading component...
Pair onInputValueChange with a debounced fetch and feed the resulting options back in. Toggle loading while the
request is in flight to show an inline spinner and suppress the default "No options found." message.
<Combobox
loading={loading}
onChange={setValue}
onInputValueChange={setQuery}
options={options}
emptyState="No topics match that query."
value={value}
/>Rich Option Rows
Loading component...
Use renderOption to render each row as a two-line label + metadata cell. Attach arbitrary per-option data via the
optional data field.
<Combobox
options={BROKERS}
renderOption={(option) => {
const meta = option.data as BrokerMeta | undefined;
return (
<div className="flex flex-col">
<span className="font-medium text-sm">{option.label}</span>
{meta ? <span className="text-muted-foreground text-xs">{meta.host} · {meta.dc}</span> : null}
</div>
);
}}
onChange={setValue}
value={value}
/>Disabled Items
Loading component...
Mark a ComboboxOption as disabled: true to render it as a non-selectable row. Compose with renderOption to
surface the reason it's unavailable.
const OPTIONS: ComboboxOption[] = [
{ value: 'reader', label: 'Reader' },
{ value: 'maintainer', label: 'Maintainer', disabled: true },
{ value: 'admin', label: 'Admin', disabled: true },
];Credits
- We take our inspiration from Shadcn UI for the combobox component and style.
Recent changes
- patchv1.2.0Pin shipped dependency floors to the version we develop against. Registry items now declare ranges like `^5.1.9` (the actual installed version) instead of collapsing to `^5.0.0`, so consumers start on the known-tested b…#133
- minorv1.1.0Theme docs refresh, readability pass on semantic foregrounds, and consumer-facing Base UI regression fixes.#121
- minorv1.0.0Post-Base-UI polish. Public API unchanged.#116
- majorv1.0.0Migrate every Radix-based primitive to `@base-ui/react@^1.4.0` (Base UI).#114
- minorv0.3.0Add theme-provider component to the registry with documentation and tests. Includes playground type improvements (export RegistryItem, remove as-const boilerplate) and docs site dark mode border color fix.#109
Built by malinskibeniamin. The source code is available on GitHub.