Combobox
Type to filter a list, then pick one or several.
Install and use
The first command adds the component and the Mine theme, the second adds this example. Render <Mine> once near your root for the skin, sounds and narrator.
"use client"
import {
Combobox,
ComboboxContent,
ComboboxEmpty,
ComboboxInput,
ComboboxItem,
ComboboxItemIndicator,
ComboboxLabel,
ComboboxList,
ComboboxTrigger,
} from "@/components/ui/combobox"
import { CheckIcon, ChevronDownIcon } from "lucide-react"
const frameworks = [
{ value: "next", label: "Next.js" },
{ value: "sveltekit", label: "SvelteKit" },
{ value: "nuxt", label: "Nuxt" },
{ value: "remix", label: "Remix" },
{ value: "astro", label: "Astro" },
{ value: "solidstart", label: "SolidStart" },
{ value: "qwik", label: "Qwik City" },
]
function Example() {
return (
<Combobox>
<div data-slot="stack">
<ComboboxLabel>Framework</ComboboxLabel>
<div data-slot="row">
<ComboboxInput placeholder="Select a framework" />
<ComboboxTrigger aria-label="Show frameworks">
<ChevronDownIcon aria-hidden="true" />
</ComboboxTrigger>
</div>
</div>
<ComboboxContent>
<ComboboxEmpty>No frameworks found.</ComboboxEmpty>
<ComboboxList>
{frameworks.map((framework) => (
<ComboboxItem
key={framework.value}
value={framework.value}
label={framework.label}
>
{framework.label}
<ComboboxItemIndicator>
<CheckIcon aria-hidden="true" />
</ComboboxItemIndicator>
</ComboboxItem>
))}
</ComboboxList>
</ComboboxContent>
</Combobox>
)
}
export { Example }