Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Turn HTML checkbox inputs into fancy toggle switches with just a CSS class
vt-toggle is a lightweight CSS/SCSS UI library that transforms standard HTML checkbox inputs into iOS-style toggle switches with a single class.
vt-toggle is a minimal UI component library that takes any standard <input type="checkbox"> element and renders it as an animated, visually styled toggle switch. It is written entirely in CSS and SCSS, requires no JavaScript, and is published on NPM and Bower. The project is maintained by GitHub user victornpb and includes a live demo at https://victornpb.github.io/vt-toggle/.
vt-toggle) with no JavaScript or other dependencies; just load the stylesheet and add the class to a checkbox.xs (18×22), sm (32×16), md (44×22, default), and lg (64×32) classes, each with its own on/off and disabled appearance.vt-toggle mixin accepts parameters for width, height, handle margin, roundness, on-color, off-color, and a label option, letting you generate your own classes like .accent or .danger with custom colors.npm install vt-toggle), Bower (bower install vt-toggle), or loaded from the unpkg CDN at https://unpkg.com/browse/[email protected]/css/vt-toggle.css.<link> tag pointing to css/vt-toggle.css or an @import in your SCSS for the scss/vt-toggle module..accent toggle or a red .danger toggle, then reuse input.vt-toggle.accent anywhere.No. vt-toggle is purely CSS/SCSS. The only action needed is to add the vt-toggle class to a normal checkbox; no JavaScript initialization or event wiring is required.
Load css/vt-toggle.css (or import the SCSS file) and add class="vt-toggle" to your <input type="checkbox">. You can also add a size class like lg for a larger switch.
Use the SCSS mixin included in the package. Call vt-toggle with your preferred on-color, off-color, and dimensions inside a custom class rule, then apply that class to the checkbox.
There are four: xs (18×22), sm (32×16), md (44×22), and lg (64×32). The default size is md; you can use size classes directly on the checkbox.