A filterable select with chips, groups and async results, in a popup that resizes as you type.
Install
Add it to your project
Run this in a project set up for shadcn/ui. It writes the files and installs the npm packages.
First time: connect the Infinity UI registry
- Create a personal token on your Tokens page.
- Put it in
.env.localasINFINITYUI_TOKEN. - Add the registry to
components.json:
{
"registries": {
"@infinityui": {
"url": "https://infinityui.io/r/{name}.json",
"headers": {
"Authorization": "Bearer ${INFINITYUI_TOKEN}"
}
}
}
}Using Claude Code, Codex, Cursor, Lovable or v0? See CLI & MCP for a setup prompt.
npm packages it adds
- cn
- @base-ui/react
- @tabler/icons-react
- class-variance-authority
Code
"use client"
import {
Combobox,
ComboboxContent,
ComboboxEmpty,
ComboboxInput,
ComboboxItem,
ComboboxList,
} from "@/components/ui/combobox"
import { Label } from "@/components/ui/label"
const fruits = [
"Apple",
"Apricot",
"Banana",
"Blackberry",
"Blueberry",
"Cherry",
"Grape",
"Grapefruit",
"Kiwi",
"Lychee",
"Mango",
"Orange",
"Papaya",
"Peach",
"Pear",
"Pineapple",
"Plum",
"Raspberry",
"Strawberry",
"Watermelon",
]
export function ComboboxDemo() {
return (
<div className="flex w-full max-w-xs flex-col gap-2">
<Label htmlFor="combobox-demo">Fruit</Label>
<Combobox items={fruits}>
<ComboboxInput id="combobox-demo" placeholder="Select a fruit" />
<ComboboxContent>
<ComboboxEmpty>No fruit found.</ComboboxEmpty>
<ComboboxList>
{(item: string) => (
<ComboboxItem key={item} value={item}>
{item}
</ComboboxItem>
)}
</ComboboxList>
</ComboboxContent>
</Combobox>
</div>
)
}
































