Switch

CSS-only via ::after, colored with $color-primary, and the role keeps screen readers informed.

Any input[type=checkbox] with role="switch" turns into a pill (2.6em × 1.4em, radius 50px) with a circular knob drawn in ::after that slides right on :checked, recoloring the track to $color-primary. The role attribute doubles as the style hook and the correct semantics for screen readers.

One attribute converts any checkbox into a switch, the animation is pure CSS transition on ::after, and it degrades to a normal checkbox if the module is off.

Track and knob colors follow $color-primary, $color-gray-highlight and contrast-color($color-primary); all dimensions are in em, so .sm/.lg resize the switch proportionally.

Switches

One attribute (role="switch") converts the checkbox into a pill; the animation is a pure CSS transition on ::after, and it degrades to a normal checkbox if the module is off.

HTML
<form>
  <label>
    <input type="checkbox" role="switch" checked>
    Public profile
  </label>
  <label>
    <input type="checkbox" role="switch">
    Dark mode
  </label>
</form>