Selector
One mode of two to five: latching keys in a tray, one down at a time, each with a lamp that lights when chosen.
Kit part · Radio groups · Toggles & switches
A row of keys in a tray with one pressed down: pick a view, a range or a mode and it applies at once. It is the kit’s selector without the lamps, with sizes, a full-width row and icon segments.
Both finishes, side by side. Hover, pressed and focus are forced with .is-hover, .is-down and .is-focus; checked and disabled are real.
Aluminium
| Part | Up | Hover | Pressed | Selected | Focus | Disabled |
|---|---|---|---|---|---|---|
| Segment |
Graphite
| Part | Up | Hover | Pressed | Selected | Focus | Disabled |
|---|---|---|---|---|---|---|
| Segment |
| Name | Kind | Values | What it does |
|---|---|---|---|
| .tui-seg | class | on a div or fieldset | The tray: a recess with 3px inside and 9px corners, and a key per segment. |
| .tui-seg--plain | class | — | No lamp on each key. Use it for views and settings; without it each key carries the selector’s amber lamp. |
| --sm · --lg | class | 24 · 38 px | Sizes: a 30px key by default. The tray’s corner follows the key’s, plus the 3px gap. |
| --block | class | — | Full width, the segments sharing it equally. |
| --icon | class | — | Square segments for icons. Each input needs an aria-label. |
| role="radiogroup" · aria-label | attribute | on the tray | Names the group. Or make the tray a <fieldset> and give it a <legend>, which is not drawn. |
| label > input[type=radio] + span | element | per segment | A real radio, hidden, and its printed key. The checked one is pressed below the plate. |
| disabled | attribute | on an input | That segment at 45%, no movement; the arrow keys skip it. |
| change | event | on the input | As any radio: fires on the one that became checked. |
| ← → · ↑ ↓ | keyboard | native | Move to the neighbour and choose it, wrapping at the ends; Tab enters and leaves the group as one stop. |
| .is-hover · .is-down · .is-focus | class | on the label | Docs only: force a state. |
<div class="tui-seg tui-seg--plain" role="radiogroup" aria-label="Range">
<label><input type="radio" name="range" value="day"><span>Day</span></label>
<label><input type="radio" name="range" value="week" checked><span>Week</span></label>
<label><input type="radio" name="range" value="month"><span>Month</span></label>
</div>
<!-- Full width, and a size -->
<div class="tui-seg tui-seg--plain tui-seg--block tui-seg--lg" role="radiogroup" aria-label="View">…</div>
<!-- Icons in place of words: each is named -->
<div class="tui-seg tui-seg--plain tui-seg--icon" role="radiogroup" aria-label="Layout">
<label><input type="radio" name="layout" value="list" aria-label="List" checked><span><svg …/></span></label>
</div>// Nothing to load: radios, native. Read the choice as you would any radio group.
document.querySelectorAll('input[name="range"]').forEach((r) =>
r.addEventListener('change', () => show(r.value)));Needs kit.css only, no script. How to install the kit.
role="radiogroup" and an aria-label, or is a fieldset with a legend; both name the group.aria-label on its input, and one that is unavailable stays in the row, disabled, so the choices do not shift.The tray and the key are the kit’s recess and cap, already in the selector; this part is the selector with its lamps off and three more things. A pressed key drops the height of its skirt into the tray and takes the pressed light, so the plate’s edge shades its top. Sizes change the key and the tray together, and each keeps the corners concentric: 5, 6 or 8px of key plus the 3px gap is 8, 9 or 11px of tray. The radios are ordinary inputs, absolutely positioned and invisible, with the printed key as the span that follows each; there is no script at all.
Two to five short words, one down at a time, applied the moment you press.
5 rules in this file, with the foundations they rest on and the anti-patterns that break them. Full rules ship in the brain with the Pass.
One mode of two to five: latching keys in a tray, one down at a time, each with a lamp that lights when chosen.
Views of the same thing, switched in place: keys in a tray, the chosen view a raised cap.
One choice from a short list in a form: small round keys in a fieldset, the chosen one pressed with a printed dot.