My pattern library

9.2 #Input.switch Switch button

Toggle example guides Toggle HTML markup

On/off button that displaces a bit and lights up (with color var(--theme-color-adot5)) when pressed down.

Note: the checked state selector requires a generic <input>, without enforcing any particular type (so by switch button I don't refer to an <input> with type="button" nor to a <button>, but to a generic <input>).

Example
Markup
<div class="switch-button">
  <input id="checkbox" type="checkbox" class="hidden">
  <label for="checkbox">Press me</label>
</div>
Source: css/modules/input/switch.css, line 1