Switch
Switch — a setting that is on or off and takes effect at once. Use for: a preference that changes something straight away, with no save button (notifications, a dark theme). Don't use for: a choice th
Evidence
What the kit's own checks measured on this component, from their committed records. A result is what was found, not a certificate.
| Check | What it measures | Result | When |
|---|---|---|---|
| Controls | every prop reachable from a story's controls | 3 stories opened; none flagged | 2026-11-28 |
| Radius | corner radii from the kit's scale only | 3 stories opened; none flagged | 2026-11-28 |
| Attributes | only valid data-tk attributes and values | 3 stories opened; none flagged | 2026-11-28 |
| Titles | each story has a heading and a title | 3 stories opened; none flagged | 2026-11-28 |
| Accessibility (axe) | axe-core on each story, at desktop and phone width | 3 stories opened; none flagged | 2026-11-28 |
| Reflow at 320px | each story at 320px wide: no sideways scroll | 3 stories opened; none flagged | 2026-11-28 |
| Forced colours | each story in Windows high contrast | 3 stories opened; none flagged | 2026-11-28 |
| Reduced motion | each story with reduced motion: nothing keeps moving | 3 stories opened; none flagged | 2026-11-28 |
| Events (what it reports) | each event its contract declares, triggered and checked; nothing undeclared, no vendor called | 3 stories opened; none flagged | 2026-11-28 |
| Right to left | each story set right to left: nothing pushed off the page | 3 stories opened; none flagged | 2026-11-28 |
| Text 40% longer | every text made about 40% longer: no words cut, no sideways scroll | 3 stories opened; none flagged | 2026-11-28 |
| Keyboard (its contract's keys) | each key its contract promises, pressed on a fresh story | 1 key pressed; each does what the contract says | 2026-11-28 |
| Design matches code | the Figma component laid over the rendered code, per skin | Switch: mean Δ 3.74, worst 3.74 over 1 skin | 2026-10-17 |
| Figma | where it is drawn in the Figma library | 1 component in the library; Code Connect linked; 4 Figma properties paired or decided | |
| Tokens | the tk slots its CSS reads | reads 19 tk slots |
Not checked yet
- Screen-reader wording and reading order, heard by a person.
- Native platforms (no SwiftUI or Compose kit yet).
- No contrast pair is labelled with its elements; its colours are checked only through the components it uses.
Props
| Prop | Type | Required | In Figma |
|---|---|---|---|
| label | content | yes | Switch.Label |
| hint | content | no | Switch.Hint, Switch.Show hint |
| stateLabels | other | no | not drawn |
Keyboard and screen readers
- Space turns it on
What it reports
The kit sends nothing anywhere: a component dispatches one DOM event, tk:event, and only a page that listens forwards it. Never sent: typed text, an option's label or value, names, emails.
No tk:event: a native checkbox, so the page's own change event already reports it, and sending one would make Switch a client component. Decided 2026-11-27.
Tokens it reads
action-fill, action-text, duration-fast, ease-standard, focus-color, line-strong, radius-full, size-sm, space-1, space-2, space-3, space-4, space-5, space-6, surface-raised, target-min, text-disabled, text-primary, text-secondary