ComponentsSelection & pickers
Combobox
A text field that filters a list as you type, then keeps the option you pick.
This example uses sample data from this site: data.ts, which also needs art.ts. Copy those files from the repository, or use your own data in their place.
"use client";
import { ComboBox, ComboBoxItem } from "@/components/miyuki-ui/combobox";
import { people } from "@/registry/lib/data";
const guides = [0, 5, 7, 8, 10, 11, 2, 6].map((i) => people[i]);
export default function ComboBoxDemo() {
return (
<ComboBox
className="w-full max-w-xs"
label="Guide"
placeholder="Type a name"
defaultItems={guides}
description="Guides lead groups of up to eight."
>
{(person) => (
<ComboBoxItem id={person.handle} textValue={person.name} avatar={person.avatar} description={person.role}>
{person.name}
</ComboBoxItem>
)}
</ComboBox>
);
}Install
npx shadcn@latest add @miyuki-ui/comboboxThis needs the @miyuki-ui registry in your components.json. See Using the shadcn CLI.
Props
ComboBox
Prop
Type
ComboBoxItem
Prop
Type
ComboBoxSection
Prop
Type