Form

Every control the form styles cover, one section per family. A field is a <label>, the control, and optionally a .field-hint linked with aria-describedby — a placeholder never stands in for a label. Inputs are styled by their element type, so no class is needed.

Text inputs

Placeholders show an example value, not the field name.

Example code
    <form>
      <div class="grid-2">
        <p>
          <label for="username">Username</label>
          <input id="username" type="text" name="username" placeholder="jane_doe">
        </p>

        <p>
          <label for="email">Email</label>
          <input id="email" type="email" name="email" placeholder="jane@example.com" autocomplete="email">
        </p>

        <p>
          <label for="password">Password</label>
          <input id="password" type="password" name="password" autocomplete="current-password">
        </p>

        <p>
          <label for="age">Age</label>
          <input id="age" type="number" name="age" placeholder="42">
        </p>

        <p>
          <label for="mobile">Mobile</label>
          <input id="mobile" type="tel" name="tel" placeholder="+1 555 0100" autocomplete="tel">
        </p>

        <p>
          <label for="site">Personal site</label>
          <input id="site" type="url" name="url" placeholder="https://example.com">
        </p>
      </div>
    </form>
    

Dates and times

Format expectations belong in helper text, not in the placeholder: a placeholder disappears as soon as typing starts.

Format: MM/DD/YYYY

Example code
    <form>
      <div class="grid-2">
        <p>
          <label for="birthdate">Birth date</label>
          <input id="birthdate" type="date" name="date" aria-describedby="birthdate-hint">
          <small id="birthdate-hint" class="field-hint">Format: MM/DD/YYYY</small>
        </p>

        <p>
          <label for="birthtime">Birth time</label>
          <input id="birthtime" type="time" name="time">
        </p>

        <p>
          <label for="month">Birth month</label>
          <input id="month" type="month" name="month">
        </p>

        <p>
          <label for="timezone">Timezone</label>
          <input id="timezone" type="datetime-local" name="datetime-local">
        </p>
      </div>
    </form>
    

Select

A single value with a prompt option, a multiple selection, and a disabled control. The chevron is drawn in CSS, so the native arrow is hidden.

Hold Cmd or Ctrl to pick more than one.

Example code
    <form>
      <p>
        <label for="cuisine">Cuisine</label>
        <select id="cuisine" name="cuisine" required>
          <option selected disabled value="">Choose a cuisine</option>
          <option>Italian</option>
          <option>Japanese</option>
          <option>Indian</option>
          <option>Thai</option>
          <option>French</option>
        </select>
      </p>

      <p>
        <label for="snacks">Snacks</label>
        <select id="snacks" name="snacks" multiple size="6" aria-describedby="snacks-hint">
          <option selected>Fruits</option>
          <option selected>Nuts</option>
          <option>Cheese</option>
          <option>Chocolate</option>
          <option>Crackers</option>
        </select>
        <small id="snacks-hint" class="field-hint">Hold Cmd or Ctrl to pick more than one.</small>
      </p>

      <p>
        <label for="meal-type">Meal type</label>
        <select id="meal-type" name="meal-type" disabled>
          <option>Breakfast</option>
          <option>Lunch</option>
          <option>Dinner</option>
        </select>
      </p>
    </form>
    

Textarea

Multi-line text. Resizing stays available.

Example code
    <form>
      <p>
        <label for="message">Message</label>
        <textarea id="message" name="message" rows="4" placeholder="Anything else we should know?"></textarea>
      </p>
    </form>
    

Checkbox and radio

Both keep their native rendering and take their checked colour from the palette. Group related controls in a <fieldset> with a <legend>, and give each option its own label.

Notifications
Plan
Example code
    <form>
      <fieldset>
        <legend>Notifications</legend>
        <label>
          <input type="checkbox" name="weekly-digest" value="1" checked />
          Weekly digest
        </label>
        <label>
          <input type="checkbox" name="product-news" value="1" />
          Product news
        </label>
        <label>
          <input type="checkbox" name="partner-offers" value="1" disabled />
          Partner offers (unavailable)
        </label>
      </fieldset>

      <fieldset>
        <legend>Plan</legend>
        <label>
          <input type="radio" name="plan" value="free" checked />
          Free
        </label>
        <label>
          <input type="radio" name="plan" value="plus" />
          Plus
        </label>
        <label>
          <input type="radio" name="plan" value="pro" />
          Pro
        </label>
      </fieldset>
    </form>
    

Switch

A checkbox drawn as a track and knob: same form value, an on/off reading. The whole label is the hit area.

Example code
    <form>
      <label class="switch">
        <input type="checkbox" name="weekly-digest" role="switch" checked />
        Email me the weekly digest
      </label>

      <label class="switch">
        <input type="checkbox" name="sync" role="switch" />
        Sync progress across devices
      </label>

      <label class="switch">
        <input type="checkbox" name="beta" role="switch" disabled />
        Beta features (admin only)
      </label>
    </form>
    

Range and file inputs

Both keep their native appearance; only sizing and the file button are themed.

Example code
    <form>
      <p>
        <label for="brightness">Brightness</label>
        <input id="brightness" type="range" name="brightness" min="0" max="100">
      </p>

      <p>
        <label for="document">Upload a document</label>
        <input id="document" type="file" name="document">
      </p>

      <p>
        <label for="disabled-document">Disabled upload</label>
        <input id="disabled-document" type="file" name="disabled-document" disabled>
      </p>
    </form>
    

Validation states and actions

aria-invalid="true" marks a rejected field and aria-invalid="false" a valid one; the message that follows inherits the same colour. A required control is marked with * from the required attribute alone.

Available.

We accept this card.

Enter a complete email address.

Example code
    <form>
      <div class="grid-2">
        <p>
          <label for="required-field">Display name</label>
          <input id="required-field" type="text" name="display-name" required value="">
        </p>

        <p>
          <label for="valid-field">Username</label>
          <input id="valid-field" type="text" name="username" aria-invalid="false" value="jane_doe">
          <small class="field-hint">Available.</small>
        </p>

        <p>
          <label for="valid-select">Card type</label>
          <select id="valid-select" name="user-card" aria-invalid="false">
            <option value="visa">Visa</option>
            <option value="mc">Mastercard</option>
            <option value="amex">American Express</option>
          </select>
          <small class="field-hint">We accept this card.</small>
        </p>

        <p>
          <label for="error-field">Email</label>
          <input id="error-field" type="email" name="email" value="jane@" aria-invalid="true" aria-describedby="error-field-message">
          <small id="error-field-message" class="field-hint">Enter a complete email address.</small>
        </p>
      </div>

      <footer class="actions">
        <button type="button" class="btn-outline">Cancel</button>
        <button type="submit">Save changes</button>
      </footer>
    </form>