1
1
import { Slot , component$ , useId } from '@builder.io/qwik' ;
2
2
import {
3
- Root ,
4
- Label ,
5
- Trigger ,
6
- Value ,
7
- Marker ,
8
- ListBox ,
9
- Option ,
10
- Group ,
3
+ SelectRoot ,
4
+ SelectLabel ,
5
+ SelectTrigger ,
6
+ SelectValue ,
7
+ SelectMarker ,
8
+ SelectListBox ,
9
+ SelectOption ,
10
+ SelectGroup ,
11
11
} from '@qwik-ui/headless' ;
12
12
import { PreviewCodeExample } from 'apps/website/src/components/preview-code-example/preview-code-example' ;
13
13
14
14
export const Example01 = component$ ( ( ) => {
15
15
return (
16
16
< PreviewCodeExample >
17
17
< div q :slot = "actualComponent" >
18
- < Root >
19
- < Label class = "text-black dark:text-white" >
18
+ < SelectRoot >
19
+ < SelectLabel class = "text-black dark:text-white" >
20
20
Lorem ipsum dolor sit amet
21
- </ Label >
22
- < Trigger class = "flex justify-between items-center border-slate-200 dark:border-gray-600 border-[1px] p-4" >
23
- < Value placeholder = "Select an option! ⚡" />
24
- < Marker class = "w-6 h-6" >
21
+ </ SelectLabel >
22
+ < SelectTrigger class = "flex justify-between items-center border-slate-200 dark:border-gray-600 border-[1px] p-4" >
23
+ < SelectValue placeholder = "Select an option! ⚡" />
24
+ < SelectMarker class = "w-6 h-6" >
25
25
< svg
26
26
xmlns = "http://www.w3.org/2000/svg"
27
27
viewBox = "0 0 24 24"
@@ -33,30 +33,30 @@ export const Example01 = component$(() => {
33
33
>
34
34
< polyline points = "6 9 12 15 18 9" > </ polyline >
35
35
</ svg >
36
- </ Marker >
37
- </ Trigger >
38
- < ListBox class = "bg-slate-100 dark:bg-gray-700 border-slate-200 dark:border-gray-600 border-[1px]" >
39
- < Option value = "🚀 Qwik" class = "p-4" />
40
- < Group class = "p-4" >
41
- < Label class = "p-4" > Fruits</ Label >
36
+ </ SelectMarker >
37
+ </ SelectTrigger >
38
+ < SelectListBox class = "bg-slate-100 dark:bg-gray-700 border-slate-200 dark:border-gray-600 border-[1px]" >
39
+ < SelectOption value = "🚀 Qwik" class = "p-4" />
40
+ < SelectGroup class = "p-4" >
41
+ < SelectLabel class = "p-4" > Fruits</ SelectLabel >
42
42
{ [
43
43
{ value : '🍎 Apple' , disabled : false } ,
44
44
{ value : '🍌 Banana' , disabled : false } ,
45
45
{ value : '🍒 Cherry' , disabled : false } ,
46
46
{ value : '🐲 Dragonfruit' , disabled : true } ,
47
47
] . map ( ( option ) => {
48
48
return (
49
- < Option
49
+ < SelectOption
50
50
key = { useId ( ) }
51
51
value = { option . value }
52
52
disabled = { option . disabled }
53
53
class = "aria-disabled:text-red-500 aria-disabled:cursor-not-allowed hover:bg-slate-300 dark:hover:bg-gray-600 p-4"
54
54
/>
55
55
) ;
56
56
} ) }
57
- </ Group >
58
- </ ListBox >
59
- </ Root >
57
+ </ SelectGroup >
58
+ </ SelectListBox >
59
+ </ SelectRoot >
60
60
</ div >
61
61
62
62
< div q :slot = "codeExample" >
@@ -70,10 +70,10 @@ export const Example02 = component$(() => {
70
70
return (
71
71
< PreviewCodeExample >
72
72
< div q :slot = "actualComponent" >
73
- < Root >
74
- < Trigger class = "flex justify-between items-center border-slate-200 dark:border-gray-600 border-[1px] p-4" >
75
- < Value placeholder = "Home" />
76
- < Marker class = "w-6 h-6" >
73
+ < SelectRoot >
74
+ < SelectTrigger class = "flex justify-between items-center border-slate-200 dark:border-gray-600 border-[1px] p-4" >
75
+ < SelectValue placeholder = "Home" />
76
+ < SelectMarker class = "w-6 h-6" >
77
77
< svg
78
78
xmlns = "http://www.w3.org/2000/svg"
79
79
viewBox = "0 0 24 24"
@@ -85,14 +85,14 @@ export const Example02 = component$(() => {
85
85
>
86
86
< polyline points = "6 9 12 15 18 9" > </ polyline >
87
87
</ svg >
88
- </ Marker >
89
- </ Trigger >
90
- < ListBox class = "bg-slate-100 dark:bg-gray-700 border-slate-200 dark:border-gray-600 border-[1px]" >
91
- < Option value = "Orders" class = "p-4" />
92
- < Option value = "Settings" class = "p-4" />
93
- < Option value = "Contact us" class = "p-4" />
94
- </ ListBox >
95
- </ Root >
88
+ </ SelectMarker >
89
+ </ SelectTrigger >
90
+ < SelectListBox class = "bg-slate-100 dark:bg-gray-700 border-slate-200 dark:border-gray-600 border-[1px]" >
91
+ < SelectOption value = "Orders" class = "p-4" />
92
+ < SelectOption value = "Settings" class = "p-4" />
93
+ < SelectOption value = "Contact us" class = "p-4" />
94
+ </ SelectListBox >
95
+ </ SelectRoot >
96
96
</ div >
97
97
98
98
< div q :slot = "codeExample" >
0 commit comments