Forms and native selects

Keep labels visible, preserve entered work and make recovery easy to find.

Edit a notebook

Field notes

Three leaves on the same branch, sketched on a morning walk.

Reading status To read

View markup
<form id="spec-book-form" class="spec-stack">
          <div class="spec-fields"><div class="ex-field"><label class="ex-label" for="spec-book-title">Notebook title</label>
          <input class="ex-input" id="spec-book-title" maxlength="50" value="Field notes" required></div>
          <div class="ex-field"><label class="ex-label" for="spec-book-state">Reading status</label>
      <span class="ex-select"><select class="ex-input" id="spec-book-state"><option>To read</option><option>Reading</option><option>Finished</option></select>
      <span class="ex-select-icon" aria-hidden="true"></span></span></div></div>
          <div class="spec-actions"><button type="submit" class="ex-button ex-button--spectral">Apply changes</button></div>
        </form>

Text fields

A persistent label and a recoverable error keep a form usable.

Up to 60 characters.

View markup
<form class="atlas-stack" data-ex-recipe="text-fields">
  <div class="ex-field"><label class="ex-label" for="atlas-notebook">Notebook name</label>
    <input class="ex-input" id="atlas-notebook" required maxlength="60" aria-describedby="atlas-name-help">
    <span id="atlas-name-help" class="ex-hint">Up to 60 characters.</span>
    <span id="atlas-name-error" class="ex-error" hidden>Enter a notebook name.</span></div>
  <div class="atlas-actions"><button class="ex-button ex-button--primary" type="submit">Save name</button></div>
  <p class="atlas-status" role="status"></p>
</form>
Use in a project

Radio buttons

Use a labelled group when exactly one choice applies.

Reading order
  1. Autumn notes
  2. Spring notes

View markup
<div class="atlas-stack" data-ex-recipe="radio-buttons">
  <fieldset class="atlas-fieldset"><legend class="ex-label">Reading order</legend><div class="atlas-radio-options"><label class="ex-selection" for="atlas-reading-0"><input class="ex-radio" type="radio" id="atlas-reading-0" name="atlas-reading" value="Newest first" checked> Newest first</label><label class="ex-selection" for="atlas-reading-1"><input class="ex-radio" type="radio" id="atlas-reading-1" name="atlas-reading" value="Oldest first"> Oldest first</label></div></fieldset>
  <ol class="atlas-rows" aria-label="Notebooks in reading order"><li>Autumn notes</li><li>Spring notes</li></ol>
  <p class="atlas-status" role="status"></p>
</div>
Use in a project
Usage and implementation

Label, control, help and error

Use a native input with a persistent label. Associate help and errors through aria-describedby; use aria-invalid when invalid. State required or optional in words, and use appropriate input types and autocomplete.

<div class="ex-field">
  <label class="ex-label" for="project-name">Project name</label>
  <input class="ex-input" id="project-name"
    aria-describedby="project-name-hint">
  <p class="ex-hint" id="project-name-hint">Use a name your team recognises.</p>
</div>

Keep the chevron clear of the border

For a longer list, use a labelled select. The shared wrapper leaves 16px after the icon and 12px between it and the text.

<label class="ex-label" for="category">Category</label>
<div class="ex-select">
  <select class="ex-input" id="category">
    <option>Architecture</option>
    <option>Art</option>
    <option>Design</option>
    <option>History</option>
    <option>Nature</option>
    <option>Travel</option>
  </select>
  <span class="ex-select-icon" aria-hidden="true"></span>
</div>

Check long values, narrow screens, right-to-left text and the native picker.

Choose the right native control

Group related options with fieldset and legend. Checkboxes allow independent choices; radios share a name for one selection; a switch is a native checkbox with role="switch" and an unchanged label. Read-only text remains selectable; disabling is a different state.

Validation and recovery

When replacing native validation, provide the full replacement: an error summary, messages near controls, valid relationships and deliberate focus. Link summary items to the affected fields. Preserve values and do not move focus on every keystroke.

Client validation does not replace server validation or permissions. Guard duplicate submissions, render safe failure copy and announce pending/completion/failure through one persistent live status.

Core helper contracts

HelperResponsibility
validateFields(fields)Ordered required, maximum-length and product-supplied validation results.
focusFormField(form, id)Attempts focus only on an enabled field belonging to that form. Inherited disabled fieldsets are respected, including the native first-legend exception.
createFormSubmission({submit, onState})Pending/success/error state, duplicate-run guard, disposal and cancellation signal.

The product owns persistence, idempotency, permissions and safe server-side behaviour. Client cancellation does not prove a server write was undone.