x
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
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
<div class="tw:p-6 tw:max-w-7xl tw:mx-auto tw:space-y-8"> <!-- Header / Introduction --> <div class="tw-callout"> <p class="tw:mb-1 tw:text-sm tw:font-mono"> <strong>FORM GROUP:</strong> Reusable form layout patterns<br> <strong>COMPOSES:</strong> .form-label | .form-control | .form-select | .form-text | .invalid-feedback </p> <p class="tw:mb-0 tw:text-sm"> Form groups compose labels, inputs, helper text, and validation messages into consistent, reusable layouts. Choose the layout that best fits your form's context: vertical for standard forms, horizontal for settings panels, inline for compact search/filters, or floating for modern minimal interfaces. </p> </div> <!-- Section 1: Vertical Layout (Default) --> <div class="tw:border-t tw:pt-6"> <h2 class="tw-h4 tw:mb-4">Vertical Layout (Default)</h2> <div class="tw-callout tw:mb-4"> <p class="tw:mb-0 tw:text-sm"> <strong>Vertical:</strong> The standard form layout with labels stacked above inputs. Best for most forms, especially on mobile devices and when label text varies in length. </p> </div> <div class="tw:max-w-md tw:space-y-0"> <div class="tw-form-group"> <label class="tw-form-label tw-form-label-required" for="v-fullname">Full Name</label> <input type="text" class="tw-form-control" id="v-fullname" placeholder="Enter your full name"> </div> <div class="tw-form-group"> <label class="tw-form-label tw-form-label-required" for="v-email">Email Address</label> <input type="email" class="tw-form-control" id="v-email" placeholder="name@example.com"> <span class="tw-form-text">We'll never share your email with anyone else.</span> </div> <div class="tw-form-group"> <label class="tw-form-label tw-form-label-optional" for="v-phone">Phone Number</label> <input type="tel" class="tw-form-control" id="v-phone" placeholder="+44 7700 900000"> </div> <div class="tw-form-group"> <label class="tw-form-label" for="v-country">Country</label> <select class="tw-form-select" id="v-country"> <option selected>Choose a country...</option> <option>United Kingdom</option> <option>United States</option> <option>Canada</option> <option>Australia</option> </select> </div> </div> <div class="tw:mt-4 tw:text-sm tw:text-gray-600"> <code><div class="tw-form-group"></code><br> <code> <label class="tw-form-label">Label</label></code><br> <code> <input class="tw-form-control"></code><br> <code> <span class="tw-form-text">Helper text</span></code><br> <code></div></code> </div> </div> <!-- Section 2: Horizontal Layout --> <div class="tw:border-t tw:pt-6"> <h2 class="tw-h4 tw:mb-4">Horizontal Layout</h2> <div class="tw-callout tw:mb-4"> <p class="tw:mb-0 tw:text-sm"> <strong>Horizontal:</strong> Labels positioned beside inputs, ideal for settings forms, admin panels, and when you have consistent short labels. The label aligns with the input's text baseline. </p> </div> <div class="tw:max-w-xl tw:space-y-0"> <div class="tw-form-group-horizontal"> <label class="tw-form-label tw-form-label-required" for="h-username">Username</label> <div class="tw-form-group-input"> <input type="text" class="tw-form-control" id="h-username" placeholder="Enter username"> <span class="tw-form-text">Your unique identifier on the platform.</span> </div> </div> <div class="tw-form-group-horizontal"> <label class="tw-form-label tw-form-label-required" for="h-email">Email</label> <input type="email" class="tw-form-control" id="h-email" placeholder="name@example.com"> </div> <div class="tw-form-group-horizontal"> <label class="tw-form-label" for="h-role">Role</label> <select class="tw-form-select" id="h-role"> <option selected>Select role...</option> <option>Administrator</option> <option>Editor</option> <option>Viewer</option> </select> </div> </div> <div class="tw:mt-6"> <p class="tw:text-sm tw:font-semibold tw:mb-3">Label with different input sizes</p> <div class="tw:space-y-4"> <div class="tw:max-w-xl"> <p class="tw:text-xs tw:text-gray-500 tw:mb-2">Small input</p> <div class="tw-form-group-horizontal tw-label-auto"> <label class="tw-form-label tw-form-label-control-sm" for="hi-sm">Name</label> <input type="text" class="tw-form-control tw-form-control-sm" id="hi-sm" placeholder="Small label width"> </div> </div> <div class="tw:max-w-xl"> <p class="tw:text-xs tw:text-gray-500 tw:mb-2">Default input</p> <div class="tw-form-group-horizontal tw-label-auto"> <label class="tw-form-label" for="hi-default">Email Address</label> <input type="text" class="tw-form-control" id="hi-default" placeholder="Default label width"> </div> </div> <div class="tw:max-w-2xl"> <p class="tw:text-xs tw:text-gray-500 tw:mb-2">Large input</p> <div class="tw-form-group-horizontal tw-label-auto"> <label class="tw-form-label tw-form-label-control-lg" for="hi-lg">Company Registration</label> <input type="text" class="tw-form-control tw-form-control-lg" id="hi-lg" placeholder="Large label width"> </div> </div> </div> </div> <div class="tw:mt-6"> <p class="tw:text-sm tw:font-semibold tw:mb-3">Label Width Variants</p> <div class="tw:space-y-4"> <div class="tw:max-w-xl"> <p class="tw:text-xs tw:text-gray-500 tw:mb-2">Small label (6rem)</p> <div class="tw-form-group-horizontal tw-label-sm"> <label class="tw-form-label" for="h-sm">Name</label> <input type="text" class="tw-form-control" id="h-sm" placeholder="Small label width"> </div> </div> <div class="tw:max-w-xl"> <p class="tw:text-xs tw:text-gray-500 tw:mb-2">Default label (8rem)</p> <div class="tw-form-group-horizontal"> <label class="tw-form-label" for="h-default">Email Address</label> <input type="text" class="tw-form-control" id="h-default" placeholder="Default label width"> </div> </div> <div class="tw:max-w-2xl"> <p class="tw:text-xs tw:text-gray-500 tw:mb-2">Large label (12rem)</p> <div class="tw-form-group-horizontal tw-label-lg"> <label class="tw-form-label" for="h-lg">Company Registration</label> <input type="text" class="tw-form-control" id="h-lg" placeholder="Large label width"> </div> </div> </div> </div> <div class="tw:mt-4 tw:text-sm tw:text-gray-600"> <code><div class="tw-form-group-horizontal"></code><br> <code> <label class="tw-form-label">Label</label></code><br> <code> <input class="tw-form-control"></code><br> <code></div></code><br> <br> <code>Label widths: .label-sm (6rem) | default (8rem) | .label-lg (12rem) | .label-auto</code> </div> </div> <!-- Section 3: Inline Forms --> <div class="tw:border-t tw:pt-6"> <h2 class="tw-h4 tw:mb-4">Inline Forms</h2> <div class="tw-callout tw:mb-4"> <p class="tw:mb-0 tw:text-sm"> <strong>Inline:</strong> Multiple form groups arranged horizontally in a row. Perfect for search bars, filter controls, and compact data entry. Groups automatically flex to fill available space. </p> </div> <div class="tw:space-y-6"> <!-- Search Example --> <div> <p class="tw:text-sm tw:font-semibold tw:mb-3">Search Bar</p> <div class="tw-form-inline tw:max-w-2xl"> <div class="tw-form-group"> <label class="tw-form-label" for="inline-search">Search</label> <input type="search" class="tw-form-control" id="inline-search" placeholder="Search applications..."> </div> <div class="tw-form-group-fixed"> <label class="tw-form-label"> </label> <button type="button" class="tw-btn tw-btn-primary">Search</button> </div> </div> </div> <!-- Filter Example --> <div> <p class="tw:text-sm tw:font-semibold tw:mb-3">Filter Controls</p> <div class="tw-form-inline tw:max-w-3xl"> <div class="tw-form-group"> <label class="tw-form-label" for="inline-status">Status</label> <select class="tw-form-select" id="inline-status"> <option selected>All statuses</option> <option>Active</option> <option>Pending</option> <option>Completed</option> </select> </div> <div class="tw-form-group"> <label class="tw-form-label" for="inline-date">Date Range</label> <select class="tw-form-select" id="inline-date"> <option selected>Last 30 days</option> <option>Last 7 days</option> <option>Last 90 days</option> <option>This year</option> </select> </div> <div class="tw-form-group"> <label class="tw-form-label" for="inline-sort">Sort By</label> <select class="tw-form-select" id="inline-sort"> <option selected>Date (newest)</option> <option>Date (oldest)</option> <option>Name (A-Z)</option> <option>Name (Z-A)</option> </select> </div> <div class="tw-form-group-fixed"> <label class="tw-form-label"> </label> <button type="button" class="tw-btn tw-btn-outline-secondary">Reset</button> </div> </div> </div> <!-- Date Range Example --> <div> <p class="tw:text-sm tw:font-semibold tw:mb-3">Date Range</p> <div class="tw-form-inline tw:max-w-xl"> <div class="tw-form-group"> <label class="tw-form-label" for="inline-from">From</label> <input type="date" class="tw-form-control" id="inline-from"> </div> <div class="tw-form-group"> <label class="tw-form-label" for="inline-to">To</label> <input type="date" class="tw-form-control" id="inline-to"> </div> <div class="tw-form-group-fixed"> <label class="tw-form-label"> </label> <button type="button" class="tw-btn tw-btn-primary">Apply</button> </div> </div> </div> </div> <div class="tw:mt-4 tw:text-sm tw:text-gray-600"> <code><div class="tw-form-inline"></code><br> <code> <div class="tw-form-group">...</div></code><br> <code> <div class="tw-form-group">...</div></code><br> <code> <div class="tw-form-group-fixed">...</div></code><br> <code></div></code><br> <br> <code>Use .form-group-fixed for buttons/fixed-width elements</code> </div> </div> <!-- Section 4: Floating Labels --> <div class="tw:border-t tw:pt-6"> <h2 class="tw-h4 tw:mb-4">Floating Labels</h2> <div class="tw-callout tw:mb-4"> <p class="tw:mb-0 tw:text-sm"> <strong>Floating:</strong> Modern minimal design where the label floats inside the input and animates up on focus or when a value is entered. Requires <code>placeholder=" "</code> (space) for the CSS to detect empty state. </p> </div> <div class="tw:max-w-md tw:space-y-0"> <div class="tw-form-floating"> <input type="text" class="tw-form-control" id="float-name" placeholder=" "> <label class="tw-form-label" for="float-name">Full Name</label> </div> <div class="tw-form-floating"> <input type="email" class="tw-form-control" id="float-email" placeholder=" "> <label class="tw-form-label" for="float-email">Email Address</label> </div> <div class="tw-form-floating"> <input type="password" class="tw-form-control" id="float-password" placeholder=" "> <label class="tw-form-label" for="float-password">Password</label> </div> <div class="tw-form-floating"> <select class="tw-form-select" id="float-country"> <option selected>Choose a country...</option> <option>United Kingdom</option> <option>United States</option> <option>Canada</option> </select> <label class="tw-form-label" for="float-country">Country</label> </div> <div class="tw-form-floating"> <textarea class="tw-form-control" id="float-bio" placeholder=" " rows="3"></textarea> <label class="tw-form-label" for="float-bio">Bio</label> </div> </div> <div class="tw:mt-6"> <p class="tw:text-sm tw:font-semibold tw:mb-3">Floating Labels with Values</p> <div class="tw:max-w-md tw:space-y-0"> <div class="tw-form-floating"> <input type="text" class="tw-form-control" id="float-filled" placeholder=" " value="John Smith"> <label class="tw-form-label" for="float-filled">Full Name</label> </div> <div class="tw-form-floating"> <input type="email" class="tw-form-control" id="float-email-filled" placeholder=" " value="john@example.com"> <label class="tw-form-label" for="float-email-filled">Email Address</label> </div> </div> </div> <div class="tw:mt-4 tw:text-sm tw:text-gray-600"> <code><div class="tw-form-floating"></code><br> <code> <input class="tw-form-control" placeholder=" "></code><br> <code> <label class="tw-form-label">Label</label></code><br> <code></div></code><br> <br> <code>Note: Input must come BEFORE label. Use placeholder=" " (space) for empty state detection.</code> </div> </div> <!-- Section 5: Form Row (Grid Layout) --> <div class="tw:border-t tw:pt-6"> <h2 class="tw-h4 tw:mb-4">Form Row (Grid Layout)</h2> <div class="tw-callout tw:mb-4"> <p class="tw:mb-0 tw:text-sm"> <strong>Form Row:</strong> Multi-column form layouts using a flexible grid system. Columns automatically stack on mobile. Use column width classes to control proportions. </p> </div> <div class="tw:space-y-6"> <!-- Two Columns --> <div> <p class="tw:text-sm tw:font-semibold tw:mb-3">Two Columns (50/50)</p> <div class="tw-form-row tw:max-w-2xl"> <div class="tw-form-group tw-form-group-col-6"> <label class="tw-form-label tw-form-label-required" for="row-first">First Name</label> <input type="text" class="tw-form-control" id="row-first" placeholder="John"> </div> <div class="tw-form-group tw-form-group-col-6"> <label class="tw-form-label tw-form-label-required" for="row-last">Last Name</label> <input type="text" class="tw-form-control" id="row-last" placeholder="Smith"> </div> </div> </div> <!-- Three Columns --> <div> <p class="tw:text-sm tw:font-semibold tw:mb-3">Three Columns (33/33/33)</p> <div class="tw-form-row tw:max-w-3xl"> <div class="tw-form-group tw-form-group-col-4"> <label class="tw-form-label" for="row-city">City</label> <input type="text" class="tw-form-control" id="row-city" placeholder="London"> </div> <div class="tw-form-group tw-form-group-col-4"> <label class="tw-form-label" for="row-county">County</label> <input type="text" class="tw-form-control" id="row-county" placeholder="Greater London"> </div> <div class="tw-form-group tw-form-group-col-4"> <label class="tw-form-label" for="row-postcode">Postcode</label> <input type="text" class="tw-form-control" id="row-postcode" placeholder="SW1A 1AA"> </div> </div> </div> <!-- Mixed Widths --> <div> <p class="tw:text-sm tw:font-semibold tw:mb-3">Mixed Widths (Auto + Fixed)</p> <div class="tw-form-row tw:max-w-2xl"> <div class="tw-form-group tw-form-group-col-auto"> <label class="tw-form-label" for="row-street">Street Address</label> <input type="text" class="tw-form-control" id="row-street" placeholder="10 Downing Street"> </div> <div class="tw-form-group tw-form-group-col-3"> <label class="tw-form-label" for="row-unit">Unit/Flat</label> <input type="text" class="tw-form-control" id="row-unit" placeholder="Flat 2"> </div> </div> </div> </div> <div class="tw:mt-4 tw:text-sm tw:text-gray-600"> <code><div class="tw-form-row"></code><br> <code> <div class="tw-form-group tw-form-group-col-6">...</div></code><br> <code> <div class="tw-form-group tw-form-group-col-6">...</div></code><br> <code></div></code><br> <br> <code>Columns: .form-group-col-12 (full) | .form-group-col-6 (half) | .form-group-col-4 (third) | .form-group-col-3 (quarter) | .form-group-col-auto (flex)</code> </div> </div> <!-- Section 6: Form Sections --> <div class="tw:border-t tw:pt-6"> <h2 class="tw-h4 tw:mb-4">Form Sections</h2> <div class="tw-callout tw:mb-4"> <p class="tw:mb-0 tw:text-sm"> <strong>Form Sections:</strong> Group related fields together with a title and optional description. Sections have visual separation via borders. </p> </div> <div class="tw-card tw:max-w-2xl"> <div class="tw-card-body"> <div class="tw-form-section"> <h3 class="tw-form-section-title">Personal Information</h3> <p class="tw-form-section-description">Enter your personal details as they appear on official documents.</p> <div class="tw-form-row"> <div class="tw-form-group tw-form-group-col-6"> <label class="tw-form-label tw-form-label-required" for="sec-first">First Name</label> <input type="text" class="tw-form-control" id="sec-first" placeholder="John"> </div> <div class="tw-form-group tw-form-group-col-6"> <label class="tw-form-label tw-form-label-required" for="sec-last">Last Name</label> <input type="text" class="tw-form-control" id="sec-last" placeholder="Smith"> </div> </div> <div class="tw-form-group"> <label class="tw-form-label tw-form-label-required" for="sec-dob">Date of Birth</label> <input type="date" class="tw-form-control" id="sec-dob" class="tw:max-w-[200px]"> </div> </div> <div class="tw-form-section"> <h3 class="tw-form-section-title">Contact Details</h3> <p class="tw-form-section-description">How can we reach you?</p> <div class="tw-form-group"> <label class="tw-form-label tw-form-label-required" for="sec-email">Email Address</label> <input type="email" class="tw-form-control" id="sec-email" placeholder="john@example.com"> </div> <div class="tw-form-group"> <label class="tw-form-label tw-form-label-optional" for="sec-phone">Phone Number</label> <input type="tel" class="tw-form-control" id="sec-phone" placeholder="+44 7700 900000"> </div> </div> <div class="tw-form-section"> <h3 class="tw-form-section-title">Address</h3> <div class="tw-form-group"> <label class="tw-form-label" for="sec-address1">Address Line 1</label> <input type="text" class="tw-form-control" id="sec-address1" placeholder="Street address"> </div> <div class="tw-form-group"> <label class="tw-form-label" for="sec-address2">Address Line 2</label> <input type="text" class="tw-form-control" id="sec-address2" placeholder="Apartment, suite, unit, etc."> </div> <div class="tw-form-row"> <div class="tw-form-group tw-form-group-col-6"> <label class="tw-form-label" for="sec-city">City</label> <input type="text" class="tw-form-control" id="sec-city" placeholder="City"> </div> <div class="tw-form-group tw-form-group-col-6"> <label class="tw-form-label" for="sec-postcode">Postcode</label> <input type="text" class="tw-form-control" id="sec-postcode" placeholder="Postcode"> </div> </div> </div> </div> <div class="tw-card-footer"> <div class="tw:flex tw:gap-2"> <button type="button" class="tw-btn tw-btn-primary">Save Changes</button> <button type="button" class="tw-btn tw-btn-outline-secondary">Cancel</button> </div> </div> </div> <div class="tw:mt-4 tw:text-sm tw:text-gray-600"> <code><div class="tw-form-section"></code><br> <code> <h3 class="tw-form-section-title">Section Title</h3></code><br> <code> <p class="tw-form-section-description">Description text</p></code><br> <code> <div class="tw-form-group">...</div></code><br> <code></div></code> </div> </div> <!-- Section 7: Validation in Layouts --> <div class="tw:border-t tw:pt-6"> <h2 class="tw-h4 tw:mb-4">Validation in Layouts</h2> <div class="tw-callout tw:mb-4"> <p class="tw:mb-0 tw:text-sm"> <strong>Validation:</strong> Form groups work seamlessly with validation states. Error and success messages appear below the input in all layout types. </p> </div> <div class="tw:space-y-6"> <!-- Vertical with validation --> <div> <p class="tw:text-sm tw:font-semibold tw:mb-3">Vertical Layout</p> <div class="tw:max-w-md tw:space-y-0"> <div class="tw-form-group"> <label class="tw-form-label tw-form-label-required" for="val-email">Email</label> <input type="email" class="tw-form-control tw-is-invalid" id="val-email" value="invalid-email"> <span class="tw-invalid-feedback">Please enter a valid email address.</span> </div> <div class="tw-form-group"> <label class="tw-form-label tw-form-label-required" for="val-username">Username</label> <input type="text" class="tw-form-control tw-is-valid" id="val-username" value="john_smith"> <span class="tw-valid-feedback">Username is available!</span> </div> </div> </div> <!-- Horizontal with validation --> <div> <p class="tw:text-sm tw:font-semibold tw:mb-3">Horizontal Layout</p> <div class="tw:max-w-xl tw:space-y-0"> <div class="tw-form-group-horizontal"> <label class="tw-form-label tw-form-label-required" for="val-h-email">Email</label> <div class="tw-form-group-input"> <input type="email" class="tw-form-control tw-is-invalid" id="val-h-email" value=""> <span class="tw-invalid-feedback">Email is required.</span> </div> </div> <div class="tw-form-group-horizontal"> <label class="tw-form-label" for="val-h-phone">Phone</label> <div class="tw-form-group-input"> <input type="tel" class="tw-form-control tw-is-valid" id="val-h-phone" value="+44 7700 900000"> <span class="tw-valid-feedback">Valid phone number format.</span> </div> </div> </div> </div> <!-- Floating with validation --> <div> <p class="tw:text-sm tw:font-semibold tw:mb-3">Floating Labels</p> <div class="tw:max-w-md tw:space-y-0"> <div class="tw-form-floating"> <input type="password" class="tw-form-control tw-is-invalid" id="val-float-pass" placeholder=" " value="123"> <label class="tw-form-label" for="val-float-pass">Password</label> <span class="tw-invalid-feedback">Password must be at least 8 characters.</span> </div> <div class="tw-form-floating"> <input type="text" class="tw-form-control tw-is-valid" id="val-float-code" placeholder=" " value="ABC123"> <label class="tw-form-label" for="val-float-code">Verification Code</label> <span class="tw-valid-feedback">Code verified successfully!</span> </div> </div> </div> </div> </div> <!-- Section 8: Compact Form Groups --> <div class="tw:border-t tw:pt-6"> <h2 class="tw-h4 tw:mb-4">Compact Spacing</h2> <div class="tw-callout tw:mb-4"> <p class="tw:mb-0 tw:text-sm"> <strong>Compact:</strong> Use <code>.form-group-sm</code> for reduced spacing between form groups, ideal for dense forms or modal dialogs. </p> </div> <div class="tw:max-w-md tw:space-y-0"> <div class="tw-form-group-sm"> <label class="tw-form-label tw-form-label-sm" for="compact-1">First Name</label> <input type="text" class="tw-form-control tw-form-control-sm" id="compact-1" placeholder="First name"> </div> <div class="tw-form-group-sm"> <label class="tw-form-label tw-form-label-sm" for="compact-2">Last Name</label> <input type="text" class="tw-form-control tw-form-control-sm" id="compact-2" placeholder="Last name"> </div> <div class="tw-form-group-sm"> <label class="tw-form-label tw-form-label-sm" for="compact-3">Email</label> <input type="email" class="tw-form-control tw-form-control-sm" id="compact-3" placeholder="Email"> </div> </div> <div class="tw:mt-4 tw:text-sm tw:text-gray-600"> <code><div class="tw-form-group-sm">...</div></code> </div> </div> <!-- Section 9: Real-World Example --> <div class="tw:border-t tw:pt-6"> <h2 class="tw-h4 tw:mb-4">Real-World Example: Registration Form</h2> <div class="tw-callout tw:mb-4"> <p class="tw:mb-0 tw:text-sm"> <strong>Complete Example:</strong> A registration form combining multiple layout patterns for a polished user experience. </p> </div> <div class="tw-card tw:max-w-2xl"> <div class="tw-card-header"> <h3 class="tw-card-title-sm tw:mb-0">Create Your Account</h3> </div> <div class="tw-card-body"> <div class="tw-form-row"> <div class="tw-form-group tw-form-group-col-6"> <label class="tw-form-label tw-form-label-required" for="reg-first">First Name</label> <input type="text" class="tw-form-control" id="reg-first" placeholder="John"> </div> <div class="tw-form-group tw-form-group-col-6"> <label class="tw-form-label tw-form-label-required" for="reg-last">Last Name</label> <input type="text" class="tw-form-control" id="reg-last" placeholder="Smith"> </div> </div> <div class="tw-form-group"> <label class="tw-form-label tw-form-label-required" for="reg-email">Email Address</label> <input type="email" class="tw-form-control" id="reg-email" placeholder="john@example.com"> <span class="tw-form-text">We'll send a verification link to this address.</span> </div> <div class="tw-form-row"> <div class="tw-form-group tw-form-group-col-6"> <label class="tw-form-label tw-form-label-required" for="reg-password">Password</label> <input type="password" class="tw-form-control" id="reg-password" placeholder="Create password"> <span class="tw-form-text">At least 8 characters.</span> </div> <div class="tw-form-group tw-form-group-col-6"> <label class="tw-form-label tw-form-label-required" for="reg-confirm">Confirm Password</label> <input type="password" class="tw-form-control" id="reg-confirm" placeholder="Confirm password"> </div> </div> <div class="tw-form-group"> <label class="tw-form-label tw-form-label-optional" for="reg-org">Organisation</label> <input type="text" class="tw-form-control" id="reg-org" placeholder="Company or school name"> </div> <div class="tw-form-group"> <label class="tw-form-label" for="reg-role">Role</label> <select class="tw-form-select" id="reg-role"> <option selected>Select your role...</option> <option>School Administrator</option> <option>Admissions Officer</option> <option>Teacher</option> <option>Parent/Guardian</option> <option>Other</option> </select> </div> <div class="tw-form-group"> <div class="tw-form-check"> <input class="tw-form-check-input" type="checkbox" id="reg-terms"> <label class="tw-form-check-label" for="reg-terms"> I agree to the <a href="#" class="tw:text-blue-600 tw:underline">Terms of Service</a> and <a href="#" class="tw:text-blue-600 tw:underline">Privacy Policy</a> </label> </div> </div> <div class="tw-form-group"> <div class="tw-form-check"> <input class="tw-form-check-input" type="checkbox" id="reg-newsletter"> <label class="tw-form-check-label" for="reg-newsletter"> Send me product updates and news </label> </div> </div> </div> <div class="tw-card-footer"> <button type="button" class="tw-btn tw-btn-primary tw-btn-block">Create Account</button> </div> </div> </div> <!-- Quick Reference Footer --> <div class="tw:border-t tw:pt-6 tw:mt-8"> <div class="tw-callout"> <p class="tw:mb-1 tw:text-sm tw:font-semibold">Quick Reference</p> <p class="tw:mb-0 tw:text-xs tw:font-mono"> <strong>Vertical Layout:</strong> .form-group<br> <strong>Horizontal Layout:</strong> .form-group-horizontal | .label-sm | .label-lg | .label-auto<br> <strong>Inline Forms:</strong> .form-inline > .form-group | .form-group-fixed | .form-group-auto<br> <strong>Floating Labels:</strong> .form-floating (input before label, placeholder=" ")<br> <strong>Form Row:</strong> .form-row > .form-group-col-12 | .form-group-col-6 | .form-group-col-4 | .form-group-col-3 | .form-group-col-auto<br> <strong>Form Sections:</strong> .form-section > .form-section-title + .form-section-description<br> <strong>Compact Spacing:</strong> .form-group-sm<br> <strong>Horizontal Input Wrapper:</strong> .form-group-input (for helper text/feedback in horizontal) </p> </div> </div></div>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
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
<div class="tw:p-6 tw:max-w-7xl tw:mx-auto tw:space-y-8"> <!-- Header / Introduction --> <div class="tw-callout"> <p class="tw:mb-1 tw:text-sm tw:font-mono"> <strong>FORM GROUP:</strong> Reusable form layout patterns<br> <strong>COMPOSES:</strong> .form-label | .form-control | .form-select | .form-text | .invalid-feedback </p> <p class="tw:mb-0 tw:text-sm"> Form groups compose labels, inputs, helper text, and validation messages into consistent, reusable layouts. Choose the layout that best fits your form's context: vertical for standard forms, horizontal for settings panels, inline for compact search/filters, or floating for modern minimal interfaces. </p> </div> <!-- Section 1: Vertical Layout (Default) --> <div class="tw:border-t tw:pt-6"> <h2 class="tw-h4 tw:mb-4">Vertical Layout (Default)</h2> <div class="tw-callout tw:mb-4"> <p class="tw:mb-0 tw:text-sm"> <strong>Vertical:</strong> The standard form layout with labels stacked above inputs. Best for most forms, especially on mobile devices and when label text varies in length. </p> </div> <div class="tw:max-w-md tw:space-y-0"> <div class="tw-form-group"> <label class="tw-form-label tw-form-label-required" for="v-fullname">Full Name</label> <input type="text" class="tw-form-control" id="v-fullname" placeholder="Enter your full name"> </div> <div class="tw-form-group"> <label class="tw-form-label tw-form-label-required" for="v-email">Email Address</label> <input type="email" class="tw-form-control" id="v-email" placeholder="name@example.com"> <span class="tw-form-text">We'll never share your email with anyone else.</span> </div> <div class="tw-form-group"> <label class="tw-form-label tw-form-label-optional" for="v-phone">Phone Number</label> <input type="tel" class="tw-form-control" id="v-phone" placeholder="+44 7700 900000"> </div> <div class="tw-form-group"> <label class="tw-form-label" for="v-country">Country</label> <select class="tw-form-select" id="v-country"> <option selected>Choose a country...</option> <option>United Kingdom</option> <option>United States</option> <option>Canada</option> <option>Australia</option> </select> </div> </div> <div class="tw:mt-4 tw:text-sm tw:text-gray-600"> <code><div class="tw-form-group"></code><br> <code> <label class="tw-form-label">Label</label></code><br> <code> <input class="tw-form-control"></code><br> <code> <span class="tw-form-text">Helper text</span></code><br> <code></div></code> </div> </div> <!-- Section 2: Horizontal Layout --> <div class="tw:border-t tw:pt-6"> <h2 class="tw-h4 tw:mb-4">Horizontal Layout</h2> <div class="tw-callout tw:mb-4"> <p class="tw:mb-0 tw:text-sm"> <strong>Horizontal:</strong> Labels positioned beside inputs, ideal for settings forms, admin panels, and when you have consistent short labels. The label aligns with the input's text baseline. </p> </div> <div class="tw:max-w-xl tw:space-y-0"> <div class="tw-form-group-horizontal"> <label class="tw-form-label tw-form-label-required" for="h-username">Username</label> <div class="tw-form-group-input"> <input type="text" class="tw-form-control" id="h-username" placeholder="Enter username"> <span class="tw-form-text">Your unique identifier on the platform.</span> </div> </div> <div class="tw-form-group-horizontal"> <label class="tw-form-label tw-form-label-required" for="h-email">Email</label> <input type="email" class="tw-form-control" id="h-email" placeholder="name@example.com"> </div> <div class="tw-form-group-horizontal"> <label class="tw-form-label" for="h-role">Role</label> <select class="tw-form-select" id="h-role"> <option selected>Select role...</option> <option>Administrator</option> <option>Editor</option> <option>Viewer</option> </select> </div> </div> <div class="tw:mt-6"> <p class="tw:text-sm tw:font-semibold tw:mb-3">Label with different input sizes</p> <div class="tw:space-y-4"> <div class="tw:max-w-xl"> <p class="tw:text-xs tw:text-gray-500 tw:mb-2">Small input</p> <div class="tw-form-group-horizontal tw-label-auto"> <label class="tw-form-label tw-form-label-control-sm" for="hi-sm">Name</label> <input type="text" class="tw-form-control tw-form-control-sm" id="hi-sm" placeholder="Small label width"> </div> </div> <div class="tw:max-w-xl"> <p class="tw:text-xs tw:text-gray-500 tw:mb-2">Default input</p> <div class="tw-form-group-horizontal tw-label-auto"> <label class="tw-form-label" for="hi-default">Email Address</label> <input type="text" class="tw-form-control" id="hi-default" placeholder="Default label width"> </div> </div> <div class="tw:max-w-2xl"> <p class="tw:text-xs tw:text-gray-500 tw:mb-2">Large input</p> <div class="tw-form-group-horizontal tw-label-auto"> <label class="tw-form-label tw-form-label-control-lg" for="hi-lg">Company Registration</label> <input type="text" class="tw-form-control tw-form-control-lg" id="hi-lg" placeholder="Large label width"> </div> </div> </div> </div> <div class="tw:mt-6"> <p class="tw:text-sm tw:font-semibold tw:mb-3">Label Width Variants</p> <div class="tw:space-y-4"> <div class="tw:max-w-xl"> <p class="tw:text-xs tw:text-gray-500 tw:mb-2">Small label (6rem)</p> <div class="tw-form-group-horizontal tw-label-sm"> <label class="tw-form-label" for="h-sm">Name</label> <input type="text" class="tw-form-control" id="h-sm" placeholder="Small label width"> </div> </div> <div class="tw:max-w-xl"> <p class="tw:text-xs tw:text-gray-500 tw:mb-2">Default label (8rem)</p> <div class="tw-form-group-horizontal"> <label class="tw-form-label" for="h-default">Email Address</label> <input type="text" class="tw-form-control" id="h-default" placeholder="Default label width"> </div> </div> <div class="tw:max-w-2xl"> <p class="tw:text-xs tw:text-gray-500 tw:mb-2">Large label (12rem)</p> <div class="tw-form-group-horizontal tw-label-lg"> <label class="tw-form-label" for="h-lg">Company Registration</label> <input type="text" class="tw-form-control" id="h-lg" placeholder="Large label width"> </div> </div> </div> </div> <div class="tw:mt-4 tw:text-sm tw:text-gray-600"> <code><div class="tw-form-group-horizontal"></code><br> <code> <label class="tw-form-label">Label</label></code><br> <code> <input class="tw-form-control"></code><br> <code></div></code><br><br> <code>Label widths: .label-sm (6rem) | default (8rem) | .label-lg (12rem) | .label-auto</code> </div> </div> <!-- Section 3: Inline Forms --> <div class="tw:border-t tw:pt-6"> <h2 class="tw-h4 tw:mb-4">Inline Forms</h2> <div class="tw-callout tw:mb-4"> <p class="tw:mb-0 tw:text-sm"> <strong>Inline:</strong> Multiple form groups arranged horizontally in a row. Perfect for search bars, filter controls, and compact data entry. Groups automatically flex to fill available space. </p> </div> <div class="tw:space-y-6"> <!-- Search Example --> <div> <p class="tw:text-sm tw:font-semibold tw:mb-3">Search Bar</p> <div class="tw-form-inline tw:max-w-2xl"> <div class="tw-form-group"> <label class="tw-form-label" for="inline-search">Search</label> <input type="search" class="tw-form-control" id="inline-search" placeholder="Search applications..."> </div> <div class="tw-form-group-fixed"> <label class="tw-form-label"> </label> <button type="button" class="tw-btn tw-btn-primary">Search</button> </div> </div> </div> <!-- Filter Example --> <div> <p class="tw:text-sm tw:font-semibold tw:mb-3">Filter Controls</p> <div class="tw-form-inline tw:max-w-3xl"> <div class="tw-form-group"> <label class="tw-form-label" for="inline-status">Status</label> <select class="tw-form-select" id="inline-status"> <option selected>All statuses</option> <option>Active</option> <option>Pending</option> <option>Completed</option> </select> </div> <div class="tw-form-group"> <label class="tw-form-label" for="inline-date">Date Range</label> <select class="tw-form-select" id="inline-date"> <option selected>Last 30 days</option> <option>Last 7 days</option> <option>Last 90 days</option> <option>This year</option> </select> </div> <div class="tw-form-group"> <label class="tw-form-label" for="inline-sort">Sort By</label> <select class="tw-form-select" id="inline-sort"> <option selected>Date (newest)</option> <option>Date (oldest)</option> <option>Name (A-Z)</option> <option>Name (Z-A)</option> </select> </div> <div class="tw-form-group-fixed"> <label class="tw-form-label"> </label> <button type="button" class="tw-btn tw-btn-outline-secondary">Reset</button> </div> </div> </div> <!-- Date Range Example --> <div> <p class="tw:text-sm tw:font-semibold tw:mb-3">Date Range</p> <div class="tw-form-inline tw:max-w-xl"> <div class="tw-form-group"> <label class="tw-form-label" for="inline-from">From</label> <input type="date" class="tw-form-control" id="inline-from"> </div> <div class="tw-form-group"> <label class="tw-form-label" for="inline-to">To</label> <input type="date" class="tw-form-control" id="inline-to"> </div> <div class="tw-form-group-fixed"> <label class="tw-form-label"> </label> <button type="button" class="tw-btn tw-btn-primary">Apply</button> </div> </div> </div> </div> <div class="tw:mt-4 tw:text-sm tw:text-gray-600"> <code><div class="tw-form-inline"></code><br> <code> <div class="tw-form-group">...</div></code><br> <code> <div class="tw-form-group">...</div></code><br> <code> <div class="tw-form-group-fixed">...</div></code><br> <code></div></code><br><br> <code>Use .form-group-fixed for buttons/fixed-width elements</code> </div> </div> <!-- Section 4: Floating Labels --> <div class="tw:border-t tw:pt-6"> <h2 class="tw-h4 tw:mb-4">Floating Labels</h2> <div class="tw-callout tw:mb-4"> <p class="tw:mb-0 tw:text-sm"> <strong>Floating:</strong> Modern minimal design where the label floats inside the input and animates up on focus or when a value is entered. Requires <code>placeholder=" "</code> (space) for the CSS to detect empty state. </p> </div> <div class="tw:max-w-md tw:space-y-0"> <div class="tw-form-floating"> <input type="text" class="tw-form-control" id="float-name" placeholder=" "> <label class="tw-form-label" for="float-name">Full Name</label> </div> <div class="tw-form-floating"> <input type="email" class="tw-form-control" id="float-email" placeholder=" "> <label class="tw-form-label" for="float-email">Email Address</label> </div> <div class="tw-form-floating"> <input type="password" class="tw-form-control" id="float-password" placeholder=" "> <label class="tw-form-label" for="float-password">Password</label> </div> <div class="tw-form-floating"> <select class="tw-form-select" id="float-country"> <option selected>Choose a country...</option> <option>United Kingdom</option> <option>United States</option> <option>Canada</option> </select> <label class="tw-form-label" for="float-country">Country</label> </div> <div class="tw-form-floating"> <textarea class="tw-form-control" id="float-bio" placeholder=" " rows="3"></textarea> <label class="tw-form-label" for="float-bio">Bio</label> </div> </div> <div class="tw:mt-6"> <p class="tw:text-sm tw:font-semibold tw:mb-3">Floating Labels with Values</p> <div class="tw:max-w-md tw:space-y-0"> <div class="tw-form-floating"> <input type="text" class="tw-form-control" id="float-filled" placeholder=" " value="John Smith"> <label class="tw-form-label" for="float-filled">Full Name</label> </div> <div class="tw-form-floating"> <input type="email" class="tw-form-control" id="float-email-filled" placeholder=" " value="john@example.com"> <label class="tw-form-label" for="float-email-filled">Email Address</label> </div> </div> </div> <div class="tw:mt-4 tw:text-sm tw:text-gray-600"> <code><div class="tw-form-floating"></code><br> <code> <input class="tw-form-control" placeholder=" "></code><br> <code> <label class="tw-form-label">Label</label></code><br> <code></div></code><br><br> <code>Note: Input must come BEFORE label. Use placeholder=" " (space) for empty state detection.</code> </div> </div> <!-- Section 5: Form Row (Grid Layout) --> <div class="tw:border-t tw:pt-6"> <h2 class="tw-h4 tw:mb-4">Form Row (Grid Layout)</h2> <div class="tw-callout tw:mb-4"> <p class="tw:mb-0 tw:text-sm"> <strong>Form Row:</strong> Multi-column form layouts using a flexible grid system. Columns automatically stack on mobile. Use column width classes to control proportions. </p> </div> <div class="tw:space-y-6"> <!-- Two Columns --> <div> <p class="tw:text-sm tw:font-semibold tw:mb-3">Two Columns (50/50)</p> <div class="tw-form-row tw:max-w-2xl"> <div class="tw-form-group tw-form-group-col-6"> <label class="tw-form-label tw-form-label-required" for="row-first">First Name</label> <input type="text" class="tw-form-control" id="row-first" placeholder="John"> </div> <div class="tw-form-group tw-form-group-col-6"> <label class="tw-form-label tw-form-label-required" for="row-last">Last Name</label> <input type="text" class="tw-form-control" id="row-last" placeholder="Smith"> </div> </div> </div> <!-- Three Columns --> <div> <p class="tw:text-sm tw:font-semibold tw:mb-3">Three Columns (33/33/33)</p> <div class="tw-form-row tw:max-w-3xl"> <div class="tw-form-group tw-form-group-col-4"> <label class="tw-form-label" for="row-city">City</label> <input type="text" class="tw-form-control" id="row-city" placeholder="London"> </div> <div class="tw-form-group tw-form-group-col-4"> <label class="tw-form-label" for="row-county">County</label> <input type="text" class="tw-form-control" id="row-county" placeholder="Greater London"> </div> <div class="tw-form-group tw-form-group-col-4"> <label class="tw-form-label" for="row-postcode">Postcode</label> <input type="text" class="tw-form-control" id="row-postcode" placeholder="SW1A 1AA"> </div> </div> </div> <!-- Mixed Widths --> <div> <p class="tw:text-sm tw:font-semibold tw:mb-3">Mixed Widths (Auto + Fixed)</p> <div class="tw-form-row tw:max-w-2xl"> <div class="tw-form-group tw-form-group-col-auto"> <label class="tw-form-label" for="row-street">Street Address</label> <input type="text" class="tw-form-control" id="row-street" placeholder="10 Downing Street"> </div> <div class="tw-form-group tw-form-group-col-3"> <label class="tw-form-label" for="row-unit">Unit/Flat</label> <input type="text" class="tw-form-control" id="row-unit" placeholder="Flat 2"> </div> </div> </div> </div> <div class="tw:mt-4 tw:text-sm tw:text-gray-600"> <code><div class="tw-form-row"></code><br> <code> <div class="tw-form-group tw-form-group-col-6">...</div></code><br> <code> <div class="tw-form-group tw-form-group-col-6">...</div></code><br> <code></div></code><br><br> <code>Columns: .form-group-col-12 (full) | .form-group-col-6 (half) | .form-group-col-4 (third) | .form-group-col-3 (quarter) | .form-group-col-auto (flex)</code> </div> </div> <!-- Section 6: Form Sections --> <div class="tw:border-t tw:pt-6"> <h2 class="tw-h4 tw:mb-4">Form Sections</h2> <div class="tw-callout tw:mb-4"> <p class="tw:mb-0 tw:text-sm"> <strong>Form Sections:</strong> Group related fields together with a title and optional description. Sections have visual separation via borders. </p> </div> <div class="tw-card tw:max-w-2xl"> <div class="tw-card-body"> <div class="tw-form-section"> <h3 class="tw-form-section-title">Personal Information</h3> <p class="tw-form-section-description">Enter your personal details as they appear on official documents.</p> <div class="tw-form-row"> <div class="tw-form-group tw-form-group-col-6"> <label class="tw-form-label tw-form-label-required" for="sec-first">First Name</label> <input type="text" class="tw-form-control" id="sec-first" placeholder="John"> </div> <div class="tw-form-group tw-form-group-col-6"> <label class="tw-form-label tw-form-label-required" for="sec-last">Last Name</label> <input type="text" class="tw-form-control" id="sec-last" placeholder="Smith"> </div> </div> <div class="tw-form-group"> <label class="tw-form-label tw-form-label-required" for="sec-dob">Date of Birth</label> <input type="date" class="tw-form-control" id="sec-dob" class="tw:max-w-[200px]"> </div> </div> <div class="tw-form-section"> <h3 class="tw-form-section-title">Contact Details</h3> <p class="tw-form-section-description">How can we reach you?</p> <div class="tw-form-group"> <label class="tw-form-label tw-form-label-required" for="sec-email">Email Address</label> <input type="email" class="tw-form-control" id="sec-email" placeholder="john@example.com"> </div> <div class="tw-form-group"> <label class="tw-form-label tw-form-label-optional" for="sec-phone">Phone Number</label> <input type="tel" class="tw-form-control" id="sec-phone" placeholder="+44 7700 900000"> </div> </div> <div class="tw-form-section"> <h3 class="tw-form-section-title">Address</h3> <div class="tw-form-group"> <label class="tw-form-label" for="sec-address1">Address Line 1</label> <input type="text" class="tw-form-control" id="sec-address1" placeholder="Street address"> </div> <div class="tw-form-group"> <label class="tw-form-label" for="sec-address2">Address Line 2</label> <input type="text" class="tw-form-control" id="sec-address2" placeholder="Apartment, suite, unit, etc."> </div> <div class="tw-form-row"> <div class="tw-form-group tw-form-group-col-6"> <label class="tw-form-label" for="sec-city">City</label> <input type="text" class="tw-form-control" id="sec-city" placeholder="City"> </div> <div class="tw-form-group tw-form-group-col-6"> <label class="tw-form-label" for="sec-postcode">Postcode</label> <input type="text" class="tw-form-control" id="sec-postcode" placeholder="Postcode"> </div> </div> </div> </div> <div class="tw-card-footer"> <div class="tw:flex tw:gap-2"> <button type="button" class="tw-btn tw-btn-primary">Save Changes</button> <button type="button" class="tw-btn tw-btn-outline-secondary">Cancel</button> </div> </div> </div> <div class="tw:mt-4 tw:text-sm tw:text-gray-600"> <code><div class="tw-form-section"></code><br> <code> <h3 class="tw-form-section-title">Section Title</h3></code><br> <code> <p class="tw-form-section-description">Description text</p></code><br> <code> <div class="tw-form-group">...</div></code><br> <code></div></code> </div> </div> <!-- Section 7: Validation in Layouts --> <div class="tw:border-t tw:pt-6"> <h2 class="tw-h4 tw:mb-4">Validation in Layouts</h2> <div class="tw-callout tw:mb-4"> <p class="tw:mb-0 tw:text-sm"> <strong>Validation:</strong> Form groups work seamlessly with validation states. Error and success messages appear below the input in all layout types. </p> </div> <div class="tw:space-y-6"> <!-- Vertical with validation --> <div> <p class="tw:text-sm tw:font-semibold tw:mb-3">Vertical Layout</p> <div class="tw:max-w-md tw:space-y-0"> <div class="tw-form-group"> <label class="tw-form-label tw-form-label-required" for="val-email">Email</label> <input type="email" class="tw-form-control tw-is-invalid" id="val-email" value="invalid-email"> <span class="tw-invalid-feedback">Please enter a valid email address.</span> </div> <div class="tw-form-group"> <label class="tw-form-label tw-form-label-required" for="val-username">Username</label> <input type="text" class="tw-form-control tw-is-valid" id="val-username" value="john_smith"> <span class="tw-valid-feedback">Username is available!</span> </div> </div> </div> <!-- Horizontal with validation --> <div> <p class="tw:text-sm tw:font-semibold tw:mb-3">Horizontal Layout</p> <div class="tw:max-w-xl tw:space-y-0"> <div class="tw-form-group-horizontal"> <label class="tw-form-label tw-form-label-required" for="val-h-email">Email</label> <div class="tw-form-group-input"> <input type="email" class="tw-form-control tw-is-invalid" id="val-h-email" value=""> <span class="tw-invalid-feedback">Email is required.</span> </div> </div> <div class="tw-form-group-horizontal"> <label class="tw-form-label" for="val-h-phone">Phone</label> <div class="tw-form-group-input"> <input type="tel" class="tw-form-control tw-is-valid" id="val-h-phone" value="+44 7700 900000"> <span class="tw-valid-feedback">Valid phone number format.</span> </div> </div> </div> </div> <!-- Floating with validation --> <div> <p class="tw:text-sm tw:font-semibold tw:mb-3">Floating Labels</p> <div class="tw:max-w-md tw:space-y-0"> <div class="tw-form-floating"> <input type="password" class="tw-form-control tw-is-invalid" id="val-float-pass" placeholder=" " value="123"> <label class="tw-form-label" for="val-float-pass">Password</label> <span class="tw-invalid-feedback">Password must be at least 8 characters.</span> </div> <div class="tw-form-floating"> <input type="text" class="tw-form-control tw-is-valid" id="val-float-code" placeholder=" " value="ABC123"> <label class="tw-form-label" for="val-float-code">Verification Code</label> <span class="tw-valid-feedback">Code verified successfully!</span> </div> </div> </div> </div> </div> <!-- Section 8: Compact Form Groups --> <div class="tw:border-t tw:pt-6"> <h2 class="tw-h4 tw:mb-4">Compact Spacing</h2> <div class="tw-callout tw:mb-4"> <p class="tw:mb-0 tw:text-sm"> <strong>Compact:</strong> Use <code>.form-group-sm</code> for reduced spacing between form groups, ideal for dense forms or modal dialogs. </p> </div> <div class="tw:max-w-md tw:space-y-0"> <div class="tw-form-group-sm"> <label class="tw-form-label tw-form-label-sm" for="compact-1">First Name</label> <input type="text" class="tw-form-control tw-form-control-sm" id="compact-1" placeholder="First name"> </div> <div class="tw-form-group-sm"> <label class="tw-form-label tw-form-label-sm" for="compact-2">Last Name</label> <input type="text" class="tw-form-control tw-form-control-sm" id="compact-2" placeholder="Last name"> </div> <div class="tw-form-group-sm"> <label class="tw-form-label tw-form-label-sm" for="compact-3">Email</label> <input type="email" class="tw-form-control tw-form-control-sm" id="compact-3" placeholder="Email"> </div> </div> <div class="tw:mt-4 tw:text-sm tw:text-gray-600"> <code><div class="tw-form-group-sm">...</div></code> </div> </div> <!-- Section 9: Real-World Example --> <div class="tw:border-t tw:pt-6"> <h2 class="tw-h4 tw:mb-4">Real-World Example: Registration Form</h2> <div class="tw-callout tw:mb-4"> <p class="tw:mb-0 tw:text-sm"> <strong>Complete Example:</strong> A registration form combining multiple layout patterns for a polished user experience. </p> </div> <div class="tw-card tw:max-w-2xl"> <div class="tw-card-header"> <h3 class="tw-card-title-sm tw:mb-0">Create Your Account</h3> </div> <div class="tw-card-body"> <div class="tw-form-row"> <div class="tw-form-group tw-form-group-col-6"> <label class="tw-form-label tw-form-label-required" for="reg-first">First Name</label> <input type="text" class="tw-form-control" id="reg-first" placeholder="John"> </div> <div class="tw-form-group tw-form-group-col-6"> <label class="tw-form-label tw-form-label-required" for="reg-last">Last Name</label> <input type="text" class="tw-form-control" id="reg-last" placeholder="Smith"> </div> </div> <div class="tw-form-group"> <label class="tw-form-label tw-form-label-required" for="reg-email">Email Address</label> <input type="email" class="tw-form-control" id="reg-email" placeholder="john@example.com"> <span class="tw-form-text">We'll send a verification link to this address.</span> </div> <div class="tw-form-row"> <div class="tw-form-group tw-form-group-col-6"> <label class="tw-form-label tw-form-label-required" for="reg-password">Password</label> <input type="password" class="tw-form-control" id="reg-password" placeholder="Create password"> <span class="tw-form-text">At least 8 characters.</span> </div> <div class="tw-form-group tw-form-group-col-6"> <label class="tw-form-label tw-form-label-required" for="reg-confirm">Confirm Password</label> <input type="password" class="tw-form-control" id="reg-confirm" placeholder="Confirm password"> </div> </div> <div class="tw-form-group"> <label class="tw-form-label tw-form-label-optional" for="reg-org">Organisation</label> <input type="text" class="tw-form-control" id="reg-org" placeholder="Company or school name"> </div> <div class="tw-form-group"> <label class="tw-form-label" for="reg-role">Role</label> <select class="tw-form-select" id="reg-role"> <option selected>Select your role...</option> <option>School Administrator</option> <option>Admissions Officer</option> <option>Teacher</option> <option>Parent/Guardian</option> <option>Other</option> </select> </div> <div class="tw-form-group"> <div class="tw-form-check"> <input class="tw-form-check-input" type="checkbox" id="reg-terms"> <label class="tw-form-check-label" for="reg-terms"> I agree to the <a href="#" class="tw:text-blue-600 tw:underline">Terms of Service</a> and <a href="#" class="tw:text-blue-600 tw:underline">Privacy Policy</a> </label> </div> </div> <div class="tw-form-group"> <div class="tw-form-check"> <input class="tw-form-check-input" type="checkbox" id="reg-newsletter"> <label class="tw-form-check-label" for="reg-newsletter"> Send me product updates and news </label> </div> </div> </div> <div class="tw-card-footer"> <button type="button" class="tw-btn tw-btn-primary tw-btn-block">Create Account</button> </div> </div> </div> <!-- Quick Reference Footer --> <div class="tw:border-t tw:pt-6 tw:mt-8"> <div class="tw-callout"> <p class="tw:mb-1 tw:text-sm tw:font-semibold">Quick Reference</p> <p class="tw:mb-0 tw:text-xs tw:font-mono"> <strong>Vertical Layout:</strong> .form-group<br> <strong>Horizontal Layout:</strong> .form-group-horizontal | .label-sm | .label-lg | .label-auto<br> <strong>Inline Forms:</strong> .form-inline > .form-group | .form-group-fixed | .form-group-auto<br> <strong>Floating Labels:</strong> .form-floating (input before label, placeholder=" ")<br> <strong>Form Row:</strong> .form-row > .form-group-col-12 | .form-group-col-6 | .form-group-col-4 | .form-group-col-3 | .form-group-col-auto<br> <strong>Form Sections:</strong> .form-section > .form-section-title + .form-section-description<br> <strong>Compact Spacing:</strong> .form-group-sm<br> <strong>Horizontal Input Wrapper:</strong> .form-group-input (for helper text/feedback in horizontal) </p> </div> </div></div>No notes provided.
No params configured.