import {
Combobox,
ComboboxContent,
ComboboxControl,
ComboboxInput,
ComboboxItem,
ComboboxItemIndicator,
ComboboxItemLabel,
ComboboxSection,
ComboboxTrigger
} 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() {
return (
<Combobox
itemComponent={(props) => (
<ComboboxItem item={props.item}>
<ComboboxItemLabel>{props.item.rawValue.label}</ComboboxItemLabel>
<ComboboxItemIndicator />
</ComboboxItem>
)}
optionLabel="label"
options={frameworks}
optionTextValue="label"
optionValue="value"
placeholder="Search framework..."
sectionComponent={(props) => (
<ComboboxSection>{props.section.rawValue.label}</ComboboxSection>
)}
>
<ComboboxControl aria-label="Framework">
<ComboboxInput />
<ComboboxTrigger />
</ComboboxControl>
<ComboboxContent />
</Combobox>
)
}
Sections
Components
- Accordion
- Alert Dialog
- Alert
- Aspect Ratio
- Avatar
- Badge
- Breadcrumb
- Button Group
- Button
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Form
- Hover Card
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Label
- Menubar
- Native Select
- Navigation Menu
- Pagination
- Popover
- Progress
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle Group
- Toggle
- Tooltip
- Typography