Sunflower UI
Search
Copy Code
Light Mode
multi-select-demo.tsx
multi-select.tsx
prompt.md
Collapse
Reset
Copy Code
Download
Run
1
"use client";
2
3
import * as React from "react"
4
import { MultiSelect, MultiSelectOptionDef } from "./multi-select"
5
6
const FRAMEWORKS: MultiSelectOptionDef[] = [
7
{
8
label: "React",
9
items: [
10
{ value: "next.js", label: "Next.js" },
11
{ value: "remix", label: "Remix" },
12
{ value: "astro", label: "Astro" },
13
]
14
},
15
{
16
label: "Other frameworks",
17
items: [
18
{ value: "nuxt", label: "Nuxt" },
19
{ value: "sveltekit", label: "SvelteKit" },
20
{ value: "tanstack-start", label: "TanStack Start" },
21
{ value: "legacy", label: "Legacy framework", disabled: true },
22
]
23
}
24
];
25
26
export function MultiSelectDemo() {
27
const [value, setValue] = React.useState<string[]>([])
28
29
return (
30
<div className="w-full h-full flex items-center justify-center p-4 sm:p-6 md:p-8">
31
<MultiSelect
32
value={value}
33
onValueChange={setValue}
34
options={FRAMEWORKS}
35
placeholder="Pick frameworks"
36
className="w-[270px] sm:w-[320px] max-w-full"
37
/>
38
</div>
39
)
40
}
41