|
1
|
import { Select } from "@medusajs/ui" |
|
2
|
|
|
3
|
export default function SelectDemo() { |
|
4
|
return ( |
|
5
|
<div className="w-[256px]"> |
|
6
|
<Select> |
|
7
|
<Select.Trigger> |
|
8
|
<Select.Value placeholder="Select a currency" /> |
|
9
|
</Select.Trigger> |
|
10
|
<Select.Content> |
|
11
|
{data.map((group) => ( |
|
12
|
<Select.Group key={group.label}> |
|
13
|
<Select.Label>{group.label}</Select.Label> |
|
14
|
{group.items.map((item) => ( |
|
15
|
<Select.Item key={item.value} value={item.value}> |
|
16
|
{item.label} |
|
17
|
</Select.Item> |
|
18
|
))} |
|
19
|
</Select.Group> |
|
20
|
))} |
|
21
|
</Select.Content> |
|
22
|
</Select> |
|
23
|
</div> |
|
24
|
) |
|
25
|
} |
|
26
|
|
|
27
|
const data = [ |
|
28
|
{ |
|
29
|
label: "Shirts", |
|
30
|
items: [ |
|
31
|
{ |
|
32
|
value: "dress-shirt-solid", |
|
33
|
label: "Solid Dress Shirt", |
|
34
|
}, |
|
35
|
{ |
|
36
|
value: "dress-shirt-check", |
|
37
|
label: "Check Dress Shirt", |
|
38
|
}, |
|
39
|
], |
|
40
|
}, |
|
41
|
{ |
|
42
|
label: "T-Shirts", |
|
43
|
items: [ |
|
44
|
{ |
|
45
|
value: "v-neck", |
|
46
|
label: "V-Neck", |
|
47
|
}, |
|
48
|
{ |
|
49
|
value: "crew-neck", |
|
50
|
label: "Crew Neck", |
|
51
|
}, |
|
52
|
{ |
|
53
|
value: "henley", |
|
54
|
label: "Henley", |
|
55
|
}, |
|
56
|
], |
|
57
|
}, |
|
58
|
] |