Forms and native selects
Keep labels visible, preserve entered work and make recovery easy to find.
Edit a notebook
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.
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 projectUsage 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
| Helper | Responsibility |
|---|---|
| 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.
