snapshot of https://github.com/shadcn-ui/ui.git (main, 2026-09-15; blobs > 131072B omitted)
This commit is contained in:
43
apps/v4/examples/aria/combobox-clear.tsx
Normal file
43
apps/v4/examples/aria/combobox-clear.tsx
Normal file
@@ -0,0 +1,43 @@
|
||||
"use client"
|
||||
|
||||
import {
|
||||
Combobox,
|
||||
ComboboxContent,
|
||||
ComboboxEmpty,
|
||||
ComboboxInput,
|
||||
ComboboxItem,
|
||||
ComboboxList,
|
||||
} from "@/styles/aria-nova/ui/combobox"
|
||||
|
||||
const frameworks = [
|
||||
"Next.js",
|
||||
"SvelteKit",
|
||||
"Nuxt.js",
|
||||
"Remix",
|
||||
"Astro",
|
||||
] as const
|
||||
|
||||
export function ComboboxWithClear() {
|
||||
return (
|
||||
<Combobox
|
||||
defaultValue={frameworks[0]}
|
||||
allowsEmptyCollection
|
||||
aria-label="Framework"
|
||||
>
|
||||
<ComboboxInput placeholder="Select a framework" showClear />
|
||||
<ComboboxContent>
|
||||
<ComboboxList
|
||||
renderEmptyState={() => (
|
||||
<ComboboxEmpty>No items found.</ComboboxEmpty>
|
||||
)}
|
||||
>
|
||||
{frameworks.map((item) => (
|
||||
<ComboboxItem key={item} id={item}>
|
||||
{item}
|
||||
</ComboboxItem>
|
||||
))}
|
||||
</ComboboxList>
|
||||
</ComboboxContent>
|
||||
</Combobox>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user