Skip to content
Site volume
Colourway

Components

Switch

A native switch: a pill track and a thumb that carries a dash when off and a check when on.

  • Beta
  • Reading layer
  • Server component
  • Since 0.1.0
  • Press check
Import from@maxgrits/overprint-react/switch
On this page

Example#

Look of this example
Live render of examples/switch/basic.tsx

Usage#

Use a switch for a setting that takes effect the moment it flips: notifications, a digest, a preference. The thumb carries a dash when off and a check when on, so the state reads without colour.

  • A visible label is required; showState prints "On" or "Off" after it, for settings people check at a glance.
  • Choices inside a form that apply only when it is sent are a Checkbox.
  • Motion. The thumb travels with the press easing; under reduced motion it moves at once.

Anatomy#

The parts of examples/switch/basic.tsx, numbered:
  1. Track48 × 28, pill shaped; on takes the selected face..mk-switch-track
  2. ThumbA dash when off, a check when on..mk-switch-thumb
  3. LabelNames the setting..mk-switch-label
  4. StateOptional: On or Off in words..mk-switch-state

Volume#

Reading layer: identical at every volume.

  • Quiet

    Docs, forms, legal and long reads. Flat inks, no art in motion.

  • Studio

    The site default. Art on its own plates, one display moment per view.

  • Press

    Hero moments, covers and campaigns. Halftone fields and the second ink.

  • Rave

    Launches, posters and the 404. Every ink, and the words still win.

Content#

  • The label names the thing being switched: "Weekly digest", "Sound effects". It never asks a question.
  • "On" and "Off" are the only state words; "Enabled" and "Active" mean the same thing with more letters.

Do and don't#

Do

Names the setting.

Don't

A question with a negative: does On mean off?

A switch label names what is on when the switch is on. Questions and negatives make people work out the state twice.

Accessibility#

  • A native checkbox with role="switch": Space flips it and screen readers announce on or off.
  • The thumb's dash or check and the optional "On" or "Off" word carry the state without colour.
  • Thumb travel is instant under reduced motion.
KeysWhat happens
TabMoves focus to the switch
SpaceTurns it on or off

The colour pairs it prints, with their contrast on both papers:

TextSurfaceRoleBoneNight
--mk-ink-rule--mk-paperui 3.27:1 · Lc 56.5, passes 3.65:1 · Lc 25.6, passes
--mk-ink-rule--mk-paper-sunkenui 3.01:1 · Lc 51.2, passes 3.49:1 · Lc 25.2, passes
--mk-ink-rule--mk-paper-plateui 3.65:1 · Lc 64.1, passes 3.38:1 · Lc 24.8, passes

Process at Studio, normal contrast. Every look: the press check.

Props#

PropTypeDefaultDescription
label requiredReactNodenoneRequired: the visible label.
descriptionReactNodenone
showStatebooleannonePrints "On" / "Off" after the label (hidden from assistive tech, which hears the switch state).
onLabelstringnone
offLabelstringnone
classNamestringnoneLands on the row (`label.mk-switch`).
styleCSSPropertiesnoneLands on the row.

Plus 304 React and DOM attributes passed through to the root element (className, ref, aria-*, event handlers and the rest). Generated from SwitchProps in packages/overprint-react/src/reading/switch/switch.tsx.

Tokens#

Changelog#

Arrived in 0.1.0.

0.1.024 October 2026

  • MinorreactThe reading layer's controls, overlays, forms and visitor prefs (P2-T1 to P2-T5): every Button is the comic hit key, with IconButton, Link and Tooltip; Input, Textarea, Select, Checkbox and CheckboxGroup, Radio and RadioGroup, Switch, Slider with the ruler, RulerReadout and SegmentedControl; Dialog, Drawer, NavSheet, Tabs, Disclosure, Faq and faqJsonLd on Base UI 1.9 where the platform falls short; Field, Fieldset, Form with the site's inline validation, ErrorSummary, Callout, Honeypot, FormTimestamp and QuoteForm; PrefsScript under 1 KB, usePref and setPref with cross-tab sync, ThemeToggle and the visitor VolumeDial; VisuallyHidden.