{"id":8615,"date":"2026-02-17T20:22:31","date_gmt":"2026-02-18T01:22:31","guid":{"rendered":"https:\/\/frontendmasters.com\/blog\/?p=8615"},"modified":"2026-02-17T20:22:31","modified_gmt":"2026-02-18T01:22:31","slug":"replicating-a-switch-input-and-polyfill","status":"publish","type":"post","link":"https:\/\/frontendmasters.com\/blog\/replicating-a-switch-input-and-polyfill\/","title":{"rendered":"Replicating a Switch Input (and Polyfill)"},"content":{"rendered":"\n<p>Safari has support for <code>&lt;input type=\"checkbox\" switch><\/code> where a normal \u2611\ufe0f checkbox turns into a toggle. You don&#8217;t strictly <em>need<\/em> the browser support to get the look, as it&#8217;s <a href=\"https:\/\/codepen.io\/chriscoyier\/pen\/ZYONZxa?editors=1100\">weirdly easy to replicate<\/a> (based on idea from Richard Keizer). But Thomas Steiner has <a href=\"https:\/\/github.com\/tomayac\/input-switch-polyfill\">a more comprehensive polyfill<\/a> if you want it to behave more exactly correctly, respecting <code>writing-mode<\/code> and <code>accent-color<\/code> and such. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Safari has support for &lt;input type=&#8221;checkbox&#8221; switch> where a normal \u2611\ufe0f checkbox turns into a toggle. You don&#8217;t strictly need the browser support to get the look, as it&#8217;s weirdly easy to replicate (based on idea from Richard Keizer). But Thomas Steiner has a more comprehensive polyfill if you want it to behave more exactly [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":8617,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[29],"tags":[7,31,454,453],"class_list":["post-8615","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-the-beat","tag-css","tag-html","tag-polyfill","tag-toggle"],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2026\/02\/pexels-photo-7111170.jpeg?fit=1880%2C1253&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/8615","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/comments?post=8615"}],"version-history":[{"count":1,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/8615\/revisions"}],"predecessor-version":[{"id":8616,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/8615\/revisions\/8616"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media\/8617"}],"wp:attachment":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media?parent=8615"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/categories?post=8615"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/tags?post=8615"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}