Triage design system v0.13.1-experiment
Home / Components / Forms & inputs

Forms & inputs

Inputs, the checkbox twin pattern, the switch, validation, save bars and the auto-submit contract.

Text inputs

focus = black border + 3px --focus ring; phones force 16px inputs to kill iOS zoom
<label for="x">Field label</label>
<input id="x" type="text" name="x" value="…">

<label for="b">Body</label>
<textarea name="body" rows="6"></textarea>

Checkbox + hidden twin

Grouped
pitfalls §7: dropping the hidden twin silently turns off into a missing key
<label class="check"><input type="checkbox" name="flag" value="1" checked>
  <input type="hidden" name="flag" value="0"> <span>Enabled</span></label>

Switch — the one boolean control

36×21 track · 15×15 knob inset 2px · 44px on coarse pointers
NOT IN THE EXPORTED KIT: ui-conventions.md names .px-sw as the shared boolean control, but the pack predates it. Triage 0.1.0 merges the verbatim CSS from app.py into core/base.css at build time (AUDIT P1, fixed). Verbs are only Enable/Disable; the route flashes the new state.
<form class="inline px-swf" method="post" action="…toggle…">
  <label class="px-sw" title="Disable {{ name }}">
    <input type="checkbox" checked onchange="this.form.requestSubmit()"
           aria-label="Disable {{ name }}"><span class="px-tr"></span>
  </label>
</form>

Validation & error summary

server-side validation re-renders with submitted values and focuses the error summary — never redirect-and-lose input
<div class="msg err" role="alert" id="form-err" tabindex="-1">{{ error }}</div>
<script>try{document.getElementById("form-err").focus();}catch(e){}</script>

Radio group

square marker like the checkbox, native input inside the label — keyboard and grouping come free
<div class="radio-group" role="radiogroup" aria-label="Filing mode">
  <label class="radio"><input type="radio" name="fmode" checked> <span>Move to folder</span></label>
  <label class="radio"><input type="radio" name="fmode"> <span>Tag only</span></label>
</div>

Slider

180 ms
square thumb keeps the geometry; the readout mirrors value spelling via Intl when a locale is set
<div class="slider-row" data-slider data-suffix=" ms">
  <input class="slider" type="range" min="50" max="1000" step="10" value="180" aria-label="Warn threshold">
  <output class="slider-val">180 ms</output>
</div>

Combobox + multi-select

Finance/Invoices
Finance/Receipts
Newsletters
Archive

urgent
invoice
travel
waiting
aria-activedescendant pattern: the input keeps focus, options are filtered in place; multi writes a comma-separated value to the mirror input for forms
<div class="cb" data-combobox>
  <input class="cb-input" role="combobox" aria-autocomplete="list" placeholder="Filter…">
  <div class="cb-list" role="listbox">
    <div class="cb-opt" role="option" data-value="Alpha">Alpha</div>
    <div class="cb-opt" role="option" data-value="Beta">Beta</div>
  </div>
  <div class="cb-empty" hidden>No match.</div>
</div>

<!-- multi-select: data-multi + .cb-chips + a [data-mirror] hidden input -->
<div class="cb" data-combobox data-multi>…<input type="hidden" data-mirror name="tags"></div>

Date picker

ISO value on the input, locale-formatted month/weekday labels via Intl, min/max disable days; native date inputs remain fine for simple cases
<div class="dp" data-datepicker data-min="2024-01-01" data-max="2027-12-31">
  <input class="dp-input" placeholder="YYYY-MM-DD" value="2026-10-06">
  <div class="dp-pop"></div>
</div>

Upload / dropzone

Drop files here or click to browse
Attachments are read locally — this demo dispatches triage:files
drag/drop, Enter/Space activation and a real file list; the component owns no transport — listen for triage:files
<div data-drop>
  <div class="drop"><strong>Drop files</strong> or click to browse</div>
  <input type="file" multiple>
  <div class="up-list"></div>
</div>
<script>document.addEventListener('triage:files', e => upload(e.detail.files));</script>

Sticky save bar

Long editor body…
blank fields fall back to defaults
sticky within the form; on phones keyboard-fit.js translates it above the tab bar and the software keyboard
<div class="savebar">
  <button class="btn primary" type="submit">Save section</button>
  <span class="sub">blank falls back to defaults</span>
</div>
Auto-submit contract. A control that mutates exactly one value may auto-submit on change — and when it does it must announce via flash or toast. Rows with several controls keep an explicit Save.
Triage Design System v0.13.1-experiment — the central, app-agnostic UI design authority. Source of truth: /tokens/tokens.json. Showcase chrome only: site/.