-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinput.vue
More file actions
338 lines (325 loc) · 7.8 KB
/
input.vue
File metadata and controls
338 lines (325 loc) · 7.8 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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
<!-- eslint-disable vue/multi-word-component-names -->
<script setup>
const inputSchema = [
{
$formkit: 'nuxtUIInput',
id: 'input-basic',
name: 'input1',
placeholder: 'Basic Input',
label: 'Basic Input',
validation: 'required',
},
{
$formkit: 'nuxtUIInput',
name: 'input2',
inputType: 'email',
placeholder: 'your.email@example.com',
label: 'Email Address',
autocomplete: 'email',
validation: 'required|email',
},
{
$formkit: 'nuxtUIInput',
name: 'input3',
inputType: 'password',
placeholder: 'Enter password',
label: 'Password',
autocomplete: 'current-password',
minLength: 8,
validation: 'required|length:8',
},
{
$formkit: 'nuxtUIInput',
name: 'input4',
inputType: 'number',
placeholder: '0',
label: 'Number Input (Min: 0, Max: 100)',
min: 0,
max: 100,
step: 5,
},
{
$formkit: 'nuxtUIInput',
name: 'input5',
inputType: 'tel',
placeholder: '+1 (555) 123-4567',
label: 'Phone Number',
autocomplete: 'tel',
pattern: '[0-9+\\-\\s()]+',
},
{
$formkit: 'nuxtUIInput',
name: 'input6',
inputType: 'url',
placeholder: 'https://example.com',
label: 'Website URL',
validation: 'url',
},
{
$formkit: 'nuxtUIInput',
name: 'input7',
inputType: 'search',
placeholder: 'Search...',
label: 'Search',
icon: 'i-heroicons-magnifying-glass',
},
{
$formkit: 'nuxtUIInput',
name: 'input8',
inputType: 'text',
placeholder: 'Enter text',
label: 'Text with Max Length',
maxLength: 50,
},
{
$formkit: 'nuxtUIInput',
name: 'input9',
placeholder: 'With Autofocus',
label: 'Autofocus Input',
autofocus: true,
},
{
$formkit: 'nuxtUIInput',
name: 'input10',
placeholder: 'With Autofocus Delay',
label: 'Autofocus with 1000ms Delay',
autofocus: true,
autofocusDelay: 1000,
},
{
$formkit: 'nuxtUIInput',
name: 'input11',
placeholder: 'With Leading Icon',
label: 'Leading Icon',
leadingIcon: 'i-heroicons-user',
},
{
$formkit: 'nuxtUIInput',
name: 'input12',
placeholder: 'With Trailing Icon',
label: 'Trailing Icon',
trailingIcon: 'i-heroicons-check-circle',
},
{
$formkit: 'nuxtUIInput',
name: 'input13',
placeholder: 'With Both Icons',
label: 'Leading and Trailing Icons',
leadingIcon: 'i-heroicons-envelope',
trailingIcon: 'i-heroicons-at-symbol',
},
{
$formkit: 'nuxtUIInput',
name: 'input14',
placeholder: 'With Avatar',
label: 'With Avatar',
avatar: { src: 'https://i.pravatar.cc/150?img=1', alt: 'User Avatar' },
},
{
$formkit: 'nuxtUIInput',
name: 'input15',
placeholder: 'Loading State',
label: 'Loading',
loading: true,
},
{
$formkit: 'nuxtUIInput',
name: 'input16',
placeholder: 'Custom Loading Icon',
label: 'Custom Loading Icon',
loading: true,
loadingIcon: 'i-heroicons-arrow-path',
},
{
$formkit: 'nuxtUIInput',
name: 'input17',
placeholder: 'Highlighted Input',
label: 'Highlight',
highlight: true,
},
{
$formkit: 'nuxtUIInput',
name: 'input18',
placeholder: 'Extra Small Size',
label: 'Size XS',
size: 'xs',
},
{
$formkit: 'nuxtUIInput',
name: 'input19',
placeholder: 'Small Size',
label: 'Size SM',
size: 'sm',
},
{
$formkit: 'nuxtUIInput',
name: 'input20',
placeholder: 'Medium Size (Default)',
label: 'Size MD',
size: 'md',
},
{
$formkit: 'nuxtUIInput',
name: 'input21',
placeholder: 'Large Size',
label: 'Size LG',
size: 'lg',
},
{
$formkit: 'nuxtUIInput',
name: 'input22',
placeholder: 'Extra Large Size',
label: 'Size XL',
size: 'xl',
},
{
$formkit: 'nuxtUIInput',
name: 'input23',
placeholder: 'Primary Color',
label: 'Primary Color',
color: 'primary',
},
{
$formkit: 'nuxtUIInput',
name: 'input24',
placeholder: 'Success Color',
label: 'Success Color',
color: 'success',
},
{
$formkit: 'nuxtUIInput',
name: 'input25',
placeholder: 'Error Color',
label: 'Error Color',
color: 'error',
},
{
$formkit: 'nuxtUIInput',
name: 'input26',
placeholder: 'Variant None',
label: 'Variant None',
variant: 'none',
},
{
$formkit: 'nuxtUIInput',
name: 'input27',
placeholder: 'Variant Ghost',
label: 'Variant Ghost',
variant: 'ghost',
},
{
$formkit: 'nuxtUIInput',
name: 'input28',
placeholder: 'Read Only',
label: 'Read Only',
readonly: true,
value: 'This is read-only',
},
{
$formkit: 'nuxtUIInput',
name: 'input29',
placeholder: 'Disabled',
label: 'Disabled',
disabled: true,
value: 'This is disabled',
},
]
</script>
<template>
<div>
<UContainer>
<div class="mb-8">
<h1 class="text-4xl font-bold mb-4">
Input Component
</h1>
<p class="text-lg text-muted-foreground mb-2">
The Input component integrates FormKit with Nuxt UI's UInput component, providing a seamless form input experience.
</p>
<p class="text-muted-foreground">
Explore various input types, autocomplete, validation attributes, icons, avatars, highlight, loading states, sizing options, and more.
</p>
</div>
<USeparator class="my-8" />
<div class="space-y-12">
<section>
<h2 class="text-2xl font-semibold mb-4">
Input Types & Validation
</h2>
<p class="text-muted-foreground mb-6">
Support for various HTML5 input types with autocomplete, min/max values, pattern validation, and length constraints.
</p>
<FUDataEdit
:data="{}"
:schema="inputSchema.slice(0, 8)"
debug-data
/>
</section>
<USeparator />
<section>
<h2 class="text-2xl font-semibold mb-4">
Autofocus
</h2>
<p class="text-muted-foreground mb-6">
Control focus behavior with autofocus and autofocus delay options.
</p>
<FUDataEdit
:data="{}"
:schema="inputSchema.slice(8, 10)"
/>
</section>
<USeparator />
<section>
<h2 class="text-2xl font-semibold mb-4">
Icons & Slots
</h2>
<p class="text-muted-foreground mb-6">
Add leading or trailing icons, avatars, and loading indicators to enhance visual appearance.
</p>
<FUDataEdit
:data="{}"
:schema="inputSchema.slice(10, 17)"
/>
</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="inputSchema.slice(17, 22)"
/>
</section>
<USeparator />
<section>
<h2 class="text-2xl font-semibold mb-4">
Colors & Variants
</h2>
<p class="text-muted-foreground mb-6">
Customize colors and variants to match your design.
</p>
<FUDataEdit
:data="{}"
:schema="inputSchema.slice(22, 27)"
/>
</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="inputSchema.slice(27, 29)"
/>
</section>
</div>
</UContainer>
</div>
</template>