mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-06-23 12:45:47 +00:00
71 lines
1.1 KiB
TypeScript
71 lines
1.1 KiB
TypeScript
import {
|
|
Combobox,
|
|
ComboboxContent,
|
|
ComboboxEmpty,
|
|
ComboboxInput,
|
|
ComboboxItem,
|
|
ComboboxList,
|
|
} from "@/examples/base/ui/combobox"
|
|
import { Select } from "@/examples/base/ui/select"
|
|
|
|
const frameworks = [
|
|
"Next.js",
|
|
"SvelteKit",
|
|
"Nuxt.js",
|
|
"Remix",
|
|
"Astro",
|
|
] as const
|
|
|
|
const items = [
|
|
{
|
|
label: "Select a framework",
|
|
value: null,
|
|
},
|
|
{
|
|
label: "React",
|
|
value: "react",
|
|
},
|
|
{
|
|
label: "Vue",
|
|
value: "vue",
|
|
},
|
|
{
|
|
label: "Angular",
|
|
value: "angular",
|
|
},
|
|
{
|
|
label: "Svelte",
|
|
value: "svelte",
|
|
},
|
|
{
|
|
label: "Solid",
|
|
value: "solid",
|
|
},
|
|
{
|
|
label: "Preact",
|
|
value: "preact",
|
|
},
|
|
{
|
|
label: "Next.js",
|
|
value: "next.js",
|
|
},
|
|
]
|
|
|
|
export function ComboboxBasic() {
|
|
return (
|
|
<Combobox items={frameworks}>
|
|
<ComboboxInput placeholder="Select a framework" />
|
|
<ComboboxContent>
|
|
<ComboboxEmpty>No items found.</ComboboxEmpty>
|
|
<ComboboxList>
|
|
{(item) => (
|
|
<ComboboxItem key={item} value={item}>
|
|
{item}
|
|
</ComboboxItem>
|
|
)}
|
|
</ComboboxList>
|
|
</ComboboxContent>
|
|
</Combobox>
|
|
)
|
|
}
|