Bootstrap 6 · Subject Guide
Forms & Spacing
Form fields, labels, checkboxes, validation, and horizontal spacing.
Version note: Bootstrap 6 is alpha. These guides use the 6.0.0-alpha.1 CDN. Some class names from your notes may require a custom build or project CSS.
1. Form field with label and helper text
Keep the label, input, and helper text together. Match the label's for value to the input's id.
We’ll never share your email with anyone else.
Ready-to-use code
<div class="form-field">
<label for="fieldText" class="form-label">Email address</label>
<input type="email" class="form-control" id="fieldText"
placeholder="name@example.com">
<div class="form-text">
We’ll never share your email with anyone else.
</div>
</div>2. Checkbox with label
Use a matching label so clicking the label toggles the checkbox.
Ready-to-use code
<div class="form-field">
<input type="checkbox" id="fieldCheck" class="check" />
<label for="fieldCheck">Remember me</label>
</div>3. Validation states
Apply is-valid or is-invalid and provide a feedback message.
Looks good!
Enter a valid email address.
Ready-to-use code
<input type="email" class="form-control is-valid">
<div class="valid-feedback">Looks good!</div>
<input type="email" class="form-control is-invalid">
<div class="invalid-feedback">Enter a valid email address.</div>4. Horizontal spacing / space-x-3
Your notes include space-x-3. If your build provides it, use it for consistent spacing between children. A portable Bootstrap-style alternative is flex with gap-3.
Ready-to-use code
<div class="d-flex align-items-center gap-3">
<button class="btn btn-primary">Save</button>
<button class="btn btn-outline-secondary">Cancel</button>
<a href="#">Help</a>
</div>
<!-- If available in your utility set -->
<div class="space-x-3">...</div>