Simulating a Switch Input (Including Polyfill)

Simulating a Switch Input (Including Polyfill)

1 Min Read

Safari includes support for “, transforming a regular ☑️ checkbox into a toggle. Even without browser support, achieving the toggle look is surprisingly simple, as demonstrated in this [CodePen example](https://codepen.io/chriscoyier/pen/ZYONZxa?editors=1100) inspired by Richard Keizer. For those seeking precise behavior that accounts for `writing-mode` and `accent-color`, Thomas Steiner offers [a more comprehensive polyfill](https://github.com/tomayac/input-switch-polyfill).

You might also like