-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselect.vue
More file actions
274 lines (261 loc) · 7.14 KB
/
select.vue
File metadata and controls
274 lines (261 loc) · 7.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
<!-- eslint-disable vue/multi-word-component-names -->
<script setup>
const selectSchema = [
{
$formkit: 'nuxtUISelect',
id: 'select-basic',
name: 'select1',
label: 'Basic Select',
help: 'This is a required field.',
validation: 'required',
options: ['Option 1', 'Option 2', 'Option 3', 'Option 4'],
placeholder: 'Select an option',
},
{
$formkit: 'nuxtUISelect',
name: 'select3',
label: 'Multiple Select',
help: 'Select multiple options',
multiple: true,
options: ['Apple', 'Banana', 'Cherry', 'Date', 'Elderberry', 'Fig'],
placeholder: 'Select fruits',
},
{
$formkit: 'nuxtUISelect',
name: 'select4',
label: 'With Autofocus',
help: 'Automatically focused',
autofocus: true,
options: ['Afghanistan', 'Albania', 'Algeria', 'Andorra', 'Angola', 'Argentina', 'Armenia', 'Australia', 'Austria', 'Azerbaijan', 'Bahamas', 'Bahrain', 'Bangladesh', 'Barbados', 'Belarus', 'Belgium', 'Belize', 'Benin', 'Bhutan', 'Bolivia'],
placeholder: 'Select a country',
},
{
$formkit: 'nuxtUISelect',
name: 'select5',
label: 'With Arrow Icon',
help: 'Shows arrow indicator',
arrow: true,
options: ['Red', 'Green', 'Blue', 'Yellow', 'Purple', 'Orange'],
placeholder: 'Select a color',
},
{
$formkit: 'nuxtUISelect',
name: 'select6',
label: 'With Highlight',
help: 'Highlighted styling',
highlight: true,
options: ['JavaScript', 'TypeScript', 'Python', 'Java'],
placeholder: 'Select a language',
},
{
$formkit: 'nuxtUISelect',
name: 'select7',
label: 'Small Size',
size: 'sm',
options: ['Small 1', 'Small 2', 'Small 3'],
placeholder: 'Small select',
},
{
$formkit: 'nuxtUISelect',
name: 'select8',
label: 'Medium Size (Default)',
size: 'md',
options: ['Medium 1', 'Medium 2', 'Medium 3'],
placeholder: 'Medium select',
},
{
$formkit: 'nuxtUISelect',
name: 'select9',
label: 'Large Size',
size: 'lg',
options: ['Large 1', 'Large 2', 'Large 3'],
placeholder: 'Large select',
},
{
$formkit: 'nuxtUISelect',
name: 'select10',
label: 'Extra Large Size',
size: 'xl',
options: ['XL 1', 'XL 2', 'XL 3'],
placeholder: 'Extra large select',
},
{
$formkit: 'nuxtUISelect',
name: 'select11',
label: 'With Leading Icon',
icon: 'i-heroicons-tag',
options: ['Tag 1', 'Tag 2', 'Tag 3'],
placeholder: 'Select with icon',
},
{
$formkit: 'nuxtUISelect',
name: 'select12',
label: 'With Trailing Icon',
trailingIcon: 'i-heroicons-chevron-down',
options: ['Option A', 'Option B', 'Option C'],
placeholder: 'Select with trailing icon',
},
{
$formkit: 'nuxtUISelect',
name: 'select13',
label: 'Loading State',
loading: true,
options: ['Loading 1', 'Loading 2', 'Loading 3'],
placeholder: 'Loading...',
},
{
$formkit: 'nuxtUISelect',
name: 'select14',
label: 'Primary Color',
color: 'primary',
size: 'lg',
options: ['Primary 1', 'Primary 2', 'Primary 3'],
placeholder: 'Primary color select',
},
{
$formkit: 'nuxtUISelect',
name: 'select15',
label: 'Variant Soft',
variant: 'soft',
options: ['Soft 1', 'Soft 2', 'Soft 3'],
placeholder: 'Soft variant',
},
{
$formkit: 'nuxtUISelect',
name: 'select16',
label: 'Variant Subtle',
variant: 'subtle',
options: ['Subtle 1', 'Subtle 2', 'Subtle 3'],
placeholder: 'Subtle variant',
},
{
$formkit: 'nuxtUISelect',
name: 'select17',
label: 'Variant Ghost',
variant: 'ghost',
options: ['Ghost 1', 'Ghost 2', 'Ghost 3'],
placeholder: 'Ghost variant',
},
{
$formkit: 'nuxtUISelect',
name: 'select18',
label: 'With Fixed Positioning',
fixed: true,
options: ['Fixed 1', 'Fixed 2', 'Fixed 3'],
placeholder: 'Fixed positioning',
},
{
$formkit: 'nuxtUISelect',
name: 'select19',
label: 'Read Only',
readonly: true,
value: 'Option 2',
options: ['Option 1', 'Option 2', 'Option 3'],
},
{
$formkit: 'nuxtUISelect',
name: 'select20',
label: 'Disabled',
disabled: true,
value: 'Disabled Option',
options: ['Disabled Option', 'Other Option'],
},
]
</script>
<template>
<div>
<UContainer>
<div class="mb-8">
<h1 class="text-4xl font-bold mb-4">
Select Component
</h1>
<p class="text-lg text-muted-foreground mb-2">
The Select component integrates FormKit with Nuxt UI's USelect component, providing a powerful dropdown selection experience.
</p>
<p class="text-muted-foreground">
Explore various configurations including multiple selection, autofocus, highlight, and different styling variants.
</p>
</div>
<USeparator class="my-8" />
<div class="space-y-12">
<section>
<h2 class="text-2xl font-semibold mb-4">
Basic Usage
</h2>
<p class="text-muted-foreground mb-6">
Basic select with simple options and object-based options.
</p>
<FUDataEdit
:data="{}"
:schema="selectSchema.slice(0, 2)"
/>
</section>
<USeparator />
<section>
<h2 class="text-2xl font-semibold mb-4">
Advanced Features
</h2>
<p class="text-muted-foreground mb-6">
Multiple selection, autofocus, arrow indicators, and highlight styling.
</p>
<FUDataEdit
:data="{}"
:schema="selectSchema.slice(2, 6)"
/>
</section>
<USeparator />
<section>
<h2 class="text-2xl font-semibold mb-4">
Sizes
</h2>
<p class="text-muted-foreground mb-6">
Available sizes: xs, sm, md (default), lg, and xl.
</p>
<FUDataEdit
:data="{}"
:schema="selectSchema.slice(6, 10)"
/>
</section>
<USeparator />
<section>
<h2 class="text-2xl font-semibold mb-4">
Icons & Loading
</h2>
<p class="text-muted-foreground mb-6">
Add icons or show loading state for better user experience.
</p>
<FUDataEdit
:data="{}"
:schema="selectSchema.slice(10, 13)"
/>
</section>
<USeparator />
<section>
<h2 class="text-2xl font-semibold mb-4">
Styling options
</h2>
<p class="text-muted-foreground mb-6">
Customize colors, variants, and fixed positioning to match your design.
</p>
<FUDataEdit
:data="{}"
:schema="selectSchema.slice(13, 18)"
/>
</section>
<USeparator />
<section>
<h2 class="text-2xl font-semibold mb-4">
States
</h2>
<p class="text-muted-foreground mb-6">
Different states including readonly and disabled.
</p>
<FUDataEdit
:data="{}"
:schema="selectSchema.slice(18, 20)"
/>
</section>
</div>
</UContainer>
</div>
</template>