snapshot of https://github.com/shadcn-ui/ui.git (main, 2026-09-15; blobs > 131072B omitted)
This commit is contained in:
55
apps/v4/examples/aria/combobox-multiple.tsx
Normal file
55
apps/v4/examples/aria/combobox-multiple.tsx
Normal file
@@ -0,0 +1,55 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
|
||||
import {
|
||||
Combobox,
|
||||
ComboboxChip,
|
||||
ComboboxChipList,
|
||||
ComboboxChips,
|
||||
ComboboxChipsInput,
|
||||
ComboboxContent,
|
||||
ComboboxEmpty,
|
||||
ComboboxItem,
|
||||
ComboboxList,
|
||||
} from "@/styles/aria-nova/ui/combobox"
|
||||
|
||||
const frameworks = [
|
||||
"Next.js",
|
||||
"SvelteKit",
|
||||
"Nuxt.js",
|
||||
"Remix",
|
||||
"Astro",
|
||||
] as const
|
||||
|
||||
export function ComboboxMultiple() {
|
||||
return (
|
||||
<Combobox
|
||||
aria-label="Frameworks"
|
||||
selectionMode="multiple"
|
||||
defaultValue={[frameworks[0]]}
|
||||
allowsEmptyCollection
|
||||
className="w-[250px] max-w-full"
|
||||
>
|
||||
<ComboboxChips>
|
||||
<ComboboxChipList<{ name: string }>>
|
||||
{(value) => <ComboboxChip id={value.name}>{value.name}</ComboboxChip>}
|
||||
</ComboboxChipList>
|
||||
<ComboboxChipsInput />
|
||||
</ComboboxChips>
|
||||
<ComboboxContent>
|
||||
<ComboboxList
|
||||
renderEmptyState={() => (
|
||||
<ComboboxEmpty>No items found.</ComboboxEmpty>
|
||||
)}
|
||||
>
|
||||
{frameworks.map((item) => (
|
||||
<ComboboxItem key={item} id={item} value={{ name: item }}>
|
||||
{item}
|
||||
</ComboboxItem>
|
||||
))}
|
||||
</ComboboxList>
|
||||
</ComboboxContent>
|
||||
</Combobox>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user