Forms
Content
Zero-class styling for every native form control: fieldset/legend layout, text inputs, textarea, a custom-drawn select, checkbox/radio, an ARIA switch variant, and a range slider — plus the adjacency rules that space form parts apart from each other and from whatever follows them.
| Name | Description |
|---|---|
fieldset |
Container grouping form controls with hairline border, radius, and subtle surface background tint. |
legend |
Bold legend label nested within fieldset. |
input, |
textarea Zero-class text controls with interface typography, raised shadow, and accent focus rings. |
select |
Custom styled dropdown with double-chevron indicator and rhythm-aligned padding. |
input[role=switch] |
Accessible toggle switch with animated sliding thumb. |
--switch-height |
Primary height sizing knob for toggle switch controls. Set it anywhere — on the switch, a class, or a container — and width and thumb follow. |
--switch-width |
Width sizing token for toggle switches (calc(var(--switch-height) * 2)). |
--switch-padding |
Inset padding controlling the toggle switch thumb gap (0px). |
--slider-value |
Percentage value driving custom filled range slider tracks. Kept in step with the thumb for every input[type=range] by StndInit (@stnd/layout); set it in the element’s own style for a non-linear slider, or mark it data-slider-fill="manual". |
A switch (role=switch on a checkbox)
<input type="checkbox" role="switch">
Live
Fieldset with adjacent button spacing
<fieldset>
<legend>Notifications</legend>
<label><input type="checkbox"> Email me</label>
</fieldset>
<button>Save</button>
Live
Text controls, zero classes
<form>
<div class="field">
<label for="ex-name">Name</label>
<input id="ex-name" type="text" placeholder="Ada Lovelace">
</div>
<div class="field">
<label for="ex-mail">Email</label>
<input id="ex-mail" type="email" placeholder="ada@example.com">
</div>
<div class="field">
<label for="ex-plan">Plan</label>
<select id="ex-plan"><option>Free</option><option>Gardener</option><option>Studio</option></select>
</div>
<div class="field">
<label for="ex-bio">Bio</label>
<textarea id="ex-bio" rows="3" placeholder="A few words about you…"></textarea>
</div>
</form>
Live
Checkbox, radio and switch
<label><input type="checkbox" checked> Checkbox</label><br>
<label><input type="radio" name="ex-r" checked> Radio</label><br>
<label><input type="checkbox" role="switch" checked> Switch on</label><br>
<label><input type="checkbox" role="switch"> Switch off</label>
Live
A switch resized from one token
<label style="--switch-height: 2rem"><input type="checkbox" role="switch" checked> A larger switch</label>
Live
Range, progress and meter
<div class="field"><label for="ex-range">Reading size</label><input id="ex-range" type="range" min="0" max="100" value="60"></div>
<div class="field"><label for="ex-progress">Export</label><progress id="ex-progress" max="100" value="45"></progress></div>
<div class="field"><label for="ex-meter">Storage</label><meter id="ex-meter" min="0" max="100" low="40" high="80" optimum="20" value="64"></meter></div>
Live
A fieldset with a legend, and the disabled state
<fieldset>
<legend>Preferences</legend>
<label><input type="checkbox" role="switch" checked> Email me when a note is published</label>
</fieldset>
<fieldset disabled>
<legend>Disabled</legend>
<input type="text" placeholder="Cannot be edited">
<button>Cannot be pressed</button>
</fieldset>
Live