FORM GROUP: Reusable form layout patterns
COMPOSES: .form-label | .form-control | .form-select | .form-text | .invalid-feedback

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.

Vertical Layout (Default)

Vertical: The standard form layout with labels stacked above inputs. Best for most forms, especially on mobile devices and when label text varies in length.

We'll never share your email with anyone else.
<div class="tw-form-group">
  <label class="tw-form-label">Label</label>
  <input class="tw-form-control">
  <span class="tw-form-text">Helper text</span>
</div>

Horizontal Layout

Horizontal: 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.

Your unique identifier on the platform.

Label with different input sizes

Small input

Default input

Large input

Label Width Variants

Small label (6rem)

Default label (8rem)

Large label (12rem)

<div class="tw-form-group-horizontal">
  <label class="tw-form-label">Label</label>
  <input class="tw-form-control">
</div>

Label widths: .label-sm (6rem) | default (8rem) | .label-lg (12rem) | .label-auto

Inline Forms

Inline: 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.

Search Bar

Filter Controls

Date Range

<div class="tw-form-inline">
  <div class="tw-form-group">...</div>
  <div class="tw-form-group">...</div>
  <div class="tw-form-group-fixed">...</div>
</div>

Use .form-group-fixed for buttons/fixed-width elements

Floating Labels

Floating: Modern minimal design where the label floats inside the input and animates up on focus or when a value is entered. Requires placeholder=" " (space) for the CSS to detect empty state.

Floating Labels with Values

<div class="tw-form-floating">
  <input class="tw-form-control" placeholder=" ">
  <label class="tw-form-label">Label</label>
</div>

Note: Input must come BEFORE label. Use placeholder=" " (space) for empty state detection.

Form Row (Grid Layout)

Form Row: Multi-column form layouts using a flexible grid system. Columns automatically stack on mobile. Use column width classes to control proportions.

Two Columns (50/50)

Three Columns (33/33/33)

Mixed Widths (Auto + Fixed)

<div class="tw-form-row">
  <div class="tw-form-group tw-form-group-col-6">...</div>
  <div class="tw-form-group tw-form-group-col-6">...</div>
</div>

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)

Form Sections

Form Sections: Group related fields together with a title and optional description. Sections have visual separation via borders.

Personal Information

Enter your personal details as they appear on official documents.

Contact Details

How can we reach you?

Address

<div class="tw-form-section">
  <h3 class="tw-form-section-title">Section Title</h3>
  <p class="tw-form-section-description">Description text</p>
  <div class="tw-form-group">...</div>
</div>

Validation in Layouts

Validation: Form groups work seamlessly with validation states. Error and success messages appear below the input in all layout types.

Vertical Layout

Please enter a valid email address.
Username is available!

Horizontal Layout

Email is required.
Valid phone number format.

Floating Labels

Password must be at least 8 characters.
Code verified successfully!

Compact Spacing

Compact: Use .form-group-sm for reduced spacing between form groups, ideal for dense forms or modal dialogs.

<div class="tw-form-group-sm">...</div>

Real-World Example: Registration Form

Complete Example: A registration form combining multiple layout patterns for a polished user experience.

Create Your Account

We'll send a verification link to this address.
At least 8 characters.

Quick Reference

Vertical Layout: .form-group
Horizontal Layout: .form-group-horizontal | .label-sm | .label-lg | .label-auto
Inline Forms: .form-inline > .form-group | .form-group-fixed | .form-group-auto
Floating Labels: .form-floating (input before label, placeholder=" ")
Form Row: .form-row > .form-group-col-12 | .form-group-col-6 | .form-group-col-4 | .form-group-col-3 | .form-group-col-auto
Form Sections: .form-section > .form-section-title + .form-section-description
Compact Spacing: .form-group-sm
Horizontal Input Wrapper: .form-group-input (for helper text/feedback in horizontal)