-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtextarea.vue
More file actions
275 lines (262 loc) · 6.53 KB
/
textarea.vue
File metadata and controls
275 lines (262 loc) · 6.53 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
<!-- eslint-disable vue/multi-word-component-names -->
<script setup>
const textareaSchema = [
{
$formkit: 'nuxtUITextarea',
id: 'textarea-basic',
name: 'textarea1',
placeholder: 'Enter your message...',
label: 'Basic Textarea',
help: 'This is a required field.',
validation: 'required',
},
{
$formkit: 'nuxtUITextarea',
name: 'textarea2',
placeholder: 'Type here...',
label: 'With Validation',
help: 'Minimum 10 characters required',
validation: 'required|length:10',
},
{
$formkit: 'nuxtUITextarea',
name: 'textarea3',
placeholder: 'Start typing...',
label: 'Fixed Rows',
help: '5 rows fixed height',
rows: 5,
},
{
$formkit: 'nuxtUITextarea',
name: 'textarea4',
placeholder: 'This textarea will resize as you type...',
label: 'Auto-resize',
help: 'Automatically resizes up to 10 rows',
rows: 3,
autoresize: true,
maxrows: 10,
},
{
$formkit: 'nuxtUITextarea',
name: 'textarea5',
placeholder: 'Fixed positioning...',
label: 'With Fixed Positioning',
help: 'Fixed positioning enabled',
rows: 4,
fixed: true,
},
{
$formkit: 'nuxtUITextarea',
name: 'textarea6',
placeholder: 'Small size...',
label: 'Small Size',
size: 'sm',
rows: 3,
},
{
$formkit: 'nuxtUITextarea',
name: 'textarea7',
placeholder: 'Medium size (default)...',
label: 'Medium Size',
size: 'md',
rows: 3,
},
{
$formkit: 'nuxtUITextarea',
name: 'textarea8',
placeholder: 'Large size...',
label: 'Large Size',
size: 'lg',
rows: 3,
},
{
$formkit: 'nuxtUITextarea',
name: 'textarea9',
placeholder: 'Extra large size...',
label: 'Extra Large Size',
size: 'xl',
rows: 3,
},
{
$formkit: 'nuxtUITextarea',
name: 'textarea10',
placeholder: 'Primary color...',
label: 'Primary Color',
color: 'primary',
rows: 3,
},
{
$formkit: 'nuxtUITextarea',
name: 'textarea11',
placeholder: 'Variant none...',
label: 'Variant None',
variant: 'none',
rows: 3,
},
{
$formkit: 'nuxtUITextarea',
name: 'textarea12',
placeholder: 'With autoresize delay...',
label: 'Autoresize with Delay',
autoresize: true,
autoresizeDelay: 300,
rows: 3,
},
{
$formkit: 'nuxtUITextarea',
name: 'textarea13',
placeholder: 'With icon...',
label: 'With Leading Icon',
icon: 'i-heroicons-pencil-square',
rows: 3,
},
{
$formkit: 'nuxtUITextarea',
name: 'textarea14',
placeholder: 'Loading state...',
label: 'Loading State',
loading: true,
rows: 3,
},
{
$formkit: 'nuxtUITextarea',
name: 'textarea15',
placeholder: 'With trailing icon...',
label: 'With Trailing Icon',
trailingIcon: 'i-heroicons-check-circle',
rows: 3,
},
{
$formkit: 'nuxtUITextarea',
name: 'textarea16',
placeholder: 'Code editor style...',
label: 'With Highlight',
highlight: true,
rows: 5,
},
{
$formkit: 'nuxtUITextarea',
name: 'textarea17',
placeholder: 'Cannot edit...',
label: 'Read Only',
readonly: true,
value: 'This content is read-only and cannot be edited.',
rows: 3,
},
{
$formkit: 'nuxtUITextarea',
name: 'textarea18',
placeholder: 'Disabled...',
label: 'Disabled',
disabled: true,
value: 'This textarea is disabled.',
rows: 3,
},
{
$formkit: 'nuxtUITextarea',
name: 'textarea19',
placeholder: 'Custom styling...',
label: 'Custom Styled',
style: { background: '#f9fafb' },
class: 'custom-textarea',
rows: 4,
},
]
</script>
<template>
<div>
<UContainer>
<div class="mb-8">
<h1 class="text-4xl font-bold mb-4">
Textarea Component
</h1>
<p class="text-lg text-muted-foreground mb-2">
The Textarea component integrates FormKit with Nuxt UI's UTextarea component, perfect for multi-line text input.
</p>
<p class="text-muted-foreground">
Explore various configurations including auto-resize, validation, styling options, and different states.
</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 textarea with validation and help text.
</p>
<FUDataEdit
:data="{}"
:schema="textareaSchema.slice(0, 2)"
/>
</section>
<USeparator />
<section>
<h2 class="text-2xl font-semibold mb-4">
Rows & Auto-resize
</h2>
<p class="text-muted-foreground mb-6">
Control the height with fixed rows or enable auto-resize to grow with content.
</p>
<FUDataEdit
:data="{}"
:schema="textareaSchema.slice(2, 5)"
/>
</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="textareaSchema.slice(5, 9)"
/>
</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 padding to match your design.
</p>
<FUDataEdit
:data="{}"
:schema="textareaSchema.slice(9, 12)"
/>
</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="textareaSchema.slice(12, 16)"
/>
</section>
<USeparator />
<section>
<h2 class="text-2xl font-semibold mb-4">
States
</h2>
<p class="text-muted-foreground mb-6">
Different states including readonly, disabled, and custom styling.
</p>
<FUDataEdit
:data="{}"
:schema="textareaSchema.slice(16, 19)"
/>
</section>
</div>
</UContainer>
</div>
</template>