Skip to the page
TACTILE UI

Kit part · Toggles & switches

Switch

On or off, applied the moment it moves. A native checkbox with a ridged thumb in a slot that lights green when on.

Element
<input type="checkbox">
Needs
kit.css
Rules
switch.rules.md · 4
Finishes
Aluminium · Graphite · Porcelain · Black
Volumes
Tactile · Quiet
On this page
  1. Variants
  2. Every state, at once
  3. API
  4. Markup
  5. Accessibility
  6. How it’s built
  7. Rules
  8. Related parts
01

Variants

In a settings row
Heat pump
In a table cell
With a second line
02

Every state, at once

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

PartOffOnFocusDisabled offDisabled on
Switch

Graphite

PartOffOnFocusDisabled offDisabled on
Switch
03

API

NameKindValuesWhat it does
.tui-switchclasson <input type="checkbox">A 48 × 26 slot with a ridged thumb that slides 16px.
checkedattribute—On: the thumb slides right and the slot lights green.
disabledattribute—45% opacity, no pointer.
name · valueattribute—Posts with a form like any checkbox.
changeevent—Native. Apply the setting here, at once.
.is-focusclass—Forced focus ring, for specimens.
Spacekeyboard—Toggles, as any checkbox.
04

Markup

<label class="tui-choice">
  Phantom power
  <input type="checkbox" class="tui-switch" checked>
</label>

Needs kit.css only, no script. How to install the kit.

05

Accessibility

  • Wrap the words and the switch in one <label class="tui-choice"> so the text names it and the whole row is clickable.
  • In a table, where there is no room for words, give it an aria-label that names the thing it powers: “Heat pump power”.
  • On is also the thumb’s position, not only the green slot.
06

How it’s built

An appearance: none checkbox. The slot is the kit’s recess; the thumb is an ::after with a raised light and a ridged grip drawn by one repeating gradient. Checked, the thumb translates 16px over 180ms and the slot fills with a mix of --tui-green and the well. No script, no images.

07

Rules

switch.rules.mdIn the brain

If the change needs a Save, it is not a switch: use a check key.

4 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.

08

Rocker

A heavier on/off for power, mains and arming: a cap that pivots in a black bezel, printed | and O.

Check

An option in a form: a small square key that presses below the plate when chosen, with a tick printed on it.

Reel 342:10
Mixed0:30

Table

Rows of data with printed column labels, figures right-aligned in columns, and status in lamps with words.

Docs
Finish
Volume