Fader
A continuous value along a line: a native range whose cap rides in a slot cut into the plate, with a printed scale.
Kit part · Knobs
A rotary control for continuous or stepped values where space is square. Its knurl and pointer turn; its light does not.
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 | Minimum | Middle | Maximum | Focus |
|---|---|---|---|---|
| Finish cap | ||||
| Black cap |
Graphite
| Part | Minimum | Middle | Maximum | Focus |
|---|---|---|---|---|
| Finish cap | ||||
| Black cap |
| Name | Kind | Values | What it does |
|---|---|---|---|
| min · max · step · value | attribute | 0 · 100 · 1 · min | The range and the start value. Values snap to the step. |
| label | attribute | required | Becomes the aria-label. Also print it under the knob in a .tui-label. |
| unit | attribute | e.g. "%", "dB" | Added to aria-valuetext: “62 %”. |
| labels | attribute | e.g. "Hobby, Team, Business" | A name for each step from min, spoken instead of the number: a detented selector says “Team”, not “1”. Print the names round it too. |
| ticks | attribute | 11 | Printed ticks around the 270° sweep; the ends and the centre are long. 11 for ±10, 21 for 0–100. |
| name | attribute | — | Form-associated: the value posts with the form under this name. |
| data-knob="black" | attribute | — | A black cap, whatever the finish around it. (data-finish only ever names a finish.) |
| --size | CSS property | 64px | Cap diameter. The element is 1.45 × this, to hold the ticks. 56–76px. |
| --turn | CSS property | set by script | The angle, −135° to 135°. Read it; the knob writes it. |
| --k-hi · --k-mid · --k-lo | CSS property | set per finish | The cap’s spun-metal tones. |
| .value | property | number | Read or set the value; setting it does not fire events. |
| input · change | event | bubbles | input while turning; change on release, and after each key or wheel step. |
| Drag | pointer | 180px end to end | Up or right turns it up. Shift: five times finer. |
| Arrows · PageUp/PageDown · Home/End | keyboard | ±step · ±10% · min/max | Up and Right turn it up. The wheel steps it while it has focus. |
| .tui-control | class | wrapper | Stacks the knob, its printed label and an <output> in a column. |
<div class="tui-control">
<tui-knob label="Treble" name="treble" min="-10" max="10" step="1" value="3" ticks="11"></tui-knob>
<span class="tui-label">Treble</span>
<output>3</output>
</div>import '/kit/kit.mjs'; // defines <tui-knob>
const knob = document.querySelector('tui-knob[name="treble"]');
const out = knob.parentElement.querySelector('output');
knob.addEventListener('input', () => { out.textContent = knob.value; });
knob.addEventListener('change', () => save(knob.value)); // on releaseNeeds kit.css and kit.mjs. How to install the kit.
role="slider" with aria-valuemin, aria-valuemax, aria-valuenow and a aria-valuetext that includes the unit.<output> under the label; do not rely on the pointer’s angle alone.The only custom element in the kit. kit.mjs draws the ticks as an inline SVG and builds four layers: the knurl (a repeating conic gradient), the sheen (a fixed linear gradient, bright toward the lamp), the spun cap (a conic gradient with a bow-tie highlight and fine radial rings), and the pointer. Only the knurl and the pointer rotate, by --turn; the sheen, the highlight and every shadow stay where the lamp puts them. It is form-associated through ElementInternals.
Never draw a sheen that turns: the lamp is above left, and it stays there.
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.
A continuous value along a line: a native range whose cap rides in a slot cut into the plate, with a printed scale.
A printed label over a value: key figures, with the unit small and the change in words.
A value that changes, on grey-green liquid crystal, with a ghost of the unlit segments behind it: clocks, battery, counters.