mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-07-08 14:35:09 +00:00
66 lines
1.2 KiB
TypeScript
66 lines
1.2 KiB
TypeScript
import {
|
|
Combobox,
|
|
ComboboxContent,
|
|
ComboboxEmpty,
|
|
ComboboxInput,
|
|
ComboboxItem,
|
|
ComboboxList,
|
|
} from "@/examples/base/ui/combobox"
|
|
import { Item } from "@/examples/base/ui/item"
|
|
import { Select } from "@/examples/base/ui/select"
|
|
|
|
const largeListItems = Array.from({ length: 100 }, (_, i) => `Item ${i + 1}`)
|
|
|
|
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 ComboboxLargeList() {
|
|
return (
|
|
<Combobox items={largeListItems}>
|
|
<ComboboxInput placeholder="Search from 100 items" />
|
|
<ComboboxContent>
|
|
<ComboboxEmpty>No items found.</ComboboxEmpty>
|
|
<ComboboxList>
|
|
{(item) => (
|
|
<ComboboxItem key={item} value={item}>
|
|
{item}
|
|
</ComboboxItem>
|
|
)}
|
|
</ComboboxList>
|
|
</ComboboxContent>
|
|
</Combobox>
|
|
)
|
|
}
|