Forms

Forms overview

A comprehensive guide to BIMA form controls, layouts, and validation.

BIMA provides styled, accessible form controls that work consistently across browsers. Every control is built on the .bima-field wrapper pattern with semantic labels and helpers.

Complete form example

A typical form combining several BIMA controls.

We'll never share your email with anyone else.
<form>
  <div class="bima-field">
    <label class="bima-label" for="full-name">Full name</label>
    <input type="text" id="full-name" class="bima-input" placeholder="e.g. Ahmad Bin Rashid">
  </div>

  <div class="bima-field">
    <label class="bima-label" for="email">Email address</label>
    <input type="email" id="email" class="bima-input" placeholder="you@example.com">
    <span class="bima-help">We'll never share your email.</span>
  </div>

  <div class="bima-field">
    <label class="bima-label" for="country">Country</label>
    <select id="country" class="bima-select" data-bima-select>
      <option value="">Select country...</option>
      <option value="gh">Ghana</option>
    </select>
  </div>

  <div class="bima-field">
    <label class="bima-label" for="message">Message</label>
    <textarea id="message" class="bima-textarea" rows="3"></textarea>
  </div>

  <div class="bima-field">
    <label class="bima-choice">
      <input type="checkbox" class="bima-check">
      I agree to the terms and conditions
    </label>
  </div>

  <button type="submit" class="bima-btn bima-btn--primary">Submit</button>
</form>

Form building blocks

The .bima-field wrapper

Wrap each label + control pair in .bima-field. This provides consistent spacing and groups the label, input, help text, and error message visually and semantically.

Labels

Always use .bima-label on your <label> elements. Labels should always reference their control via the for attribute matching the input's id.

Help text

Use .bima-help on a <span> or <p> beneath an input for contextual guidance.

Error messages

Use .bima-error-text (or .bima-invalid-feedback) inside .bima-field.is-invalid for validation error messages. See the Validation page for complete guidance.

Form sections reference

Section Key classes Description
Form controls.bima-input, .bima-textareaText inputs, textareas, sizes, states
Select.bima-selectNative select dropdowns
Checks & radios.bima-check, .bima-radio, .bima-switchCheckboxes, radios, toggle switches
Range.bima-rangeRange slider inputs
Input group.bima-input-groupText and button addons
Floating labels.bima-floatAnimated floating labels
LayoutGrid classesHorizontal, inline, and multi-column forms
Validation.is-valid, .is-invalidValidation states and feedback