JS Switchery Beautiful Checkbox Switches for Your Website

JS Switchery – Beautiful Checkbox Switches for Your Website

JS Switchery is a popular JavaScript plugin that allows users to turn simple checkboxes into eye-catching switches. This plugin offers a sleek and modern user interface enhancement for web developers and designers. Its features include customizable colors, disabled options, and transition effects that can be controlled by the user. In this article, we’ll explore the capabilities of JS Switchery and why it’s a valuable tool to consider using in web development.

What is JS Switchery?

JS Switchery is a simple, lightweight JavaScript plugin that allows developers to easily transform their HTML checkboxes into iOS-style switches. With Switchery, users can easily customize their switches to match their design theme, including choosing the color of the switch element using HEX or RGB values, defining the class name, and enabling or disabling click events and state changes through boolean values. Switchery is licensed under the MIT License, which allows developers to use and distribute the plugin freely.

Customization Options

If you want to customize the JS Switchery to match the design of your website, there are several options available:

Changing Colors

You can change the color of the switch using either HEX or RGB value. Here’s how:

Property Description
color The color of the switch element in HEX or RGB value. For example, color: '#00FF00' (green color).

By changing the color value to your desired color, you can easily change the color of the switch element.

Changing Size

If you want to adjust the size of the switch, you can do so by changing the value of the size property. Here’s how:

Property Description
size The size of the switch element in pixels. For example, size: '40' (sets the size to 40 pixels).

By tweaking the size value, you can easily customize the switch element to match your website’s design.

Other Customization Options

Aside from changing the color and size, JS Switchery also provides several other ways to customize the switch element:

Property Description
className The class name for the switch element. By default, it is styled in switchery.css.
disabled A boolean value that enables or disables click events and changing the state of the switch.
speed The length of time that the transition will take, specified in seconds. For example, speed: '0.5s' (sets the transition speed to 0.5 seconds).

If you want to add labels, you can do so by wrapping the checkbox element with a label element. You can also change the animation speed by changing the value of the speed property.

Benefits of Using JS Switchery

JS Switchery is a simple component that allows you to transform your default HTML checkbox inputs into beautiful iOS 7 style switches with just a few simple steps. Here are some of the benefits of using JS Switchery:

Improved User Experience

One of the main benefits of using JS Switchery is that it can significantly improve the user experience of your website. The iOS 7 style switches are not only visually appealing, but they also make it easier for users to interact with your website. The switches are large, easy to click, and provide clear visual feedback when clicked on. This can lead to increased user satisfaction and ultimately, improved website performance.

Consistency Across Browsers

Another benefit of using JS Switchery is that it is supported by all modern browsers, including Chrome, Firefox, Opera, Safari, and IE8+. This ensures that your switches will look and function consistently across all browsers, which can save you time and effort in testing and troubleshooting. Additionally, JS Switchery is highly customizable, so you can tailor the switches to match your website design perfectly.

How to Implement JS Switchery

If you want to add beautiful iOS 7 style switches to your website, JS Switchery is the perfect solution. Here’s how you can implement it:

Example Code

The first step is to install Switchery to your website. Once that’s done, add the following code to your HTML:

<input type=”checkbox” class=”js-switch” checked />

The class “js-switch” is what triggers the styling for JS Switchery. You can also add the “checked” attribute to ensure the checkbox is pre-checked.

Next, add the following code to your JavaScript file:

var switchery = new Switchery(document.querySelector(‘.js-switch’), { color: ‘#2c3e50’, className: ‘switchery-custom’ });

This code applies the Switchery styling to any elements on your website with the “js-switch” class. The “color” property allows you to customize the color of the switch, while the “className” property lets you customize the class name of the element.

You can also customize the speed of the transition using the “speed” property in the format “{digit}s”.

That’s it! With just a few simple steps, you can add interactive and stylish switches to your website.

JS Switchery vs Other Checkbox Solutions

When it comes to checkbox solutions, there are many options available in the market. However, JS Switchery offers some distinct advantages over other solutions.


JS Switchery boasts an excellent performance when compared to other checkbox solutions. This is because it is lightweight and focuses solely on switches, resulting in a faster and smoother user experience. Other solutions that offer additional features besides switches tend to be heavier and slower.


JS Switchery prides itself on its extensive customization options. It allows for easy customization of switches to match any design perfectly. Other checkbox solutions may not offer as many customization options or may have more complicated customization processes.


What browsers support JS Switchery?

JS Switchery is supported by all modern browsers such as Chrome, Firefox, Opera, Safari, IE8+.

How do I customize the color of the switch?

You can customize the color of the switch by providing the color of the switch element in HEX or RGB value.

Can I use JS Switchery on a mobile device?

Yes, you can use JS Switchery on a mobile device. It is compatible with iOS and Android.


Using JS Switchery to customize HTML checkbox inputs can make your website more visually appealing and user-friendly. With the ability to customize colors, class names, and transitions, Switchery can seamlessly match your design style. It is also supported by all modern browsers, making it a reliable option for enhancing your website. Incorporating Switchery can help improve the overall user experience and keep visitors engaged with your content.


Learn more about switchery and how to turn your default HTML checkbox into beautiful iOS 7 style switches by checking out the official JS Switchery documentation. This documentation offers a comprehensive and easy-to-understand guide on how to customize your switches and match your design perfectly.

For those using jQuery, the jQuery Script – Switchery offers an alternative approach to turn your checkboxes into iOS 7-style switches. This plugin is easy to install and includes a range of customization options to suit your design needs.

Creating iOS 7-style switches with CSS can be challenging, but Creative Bloq provides a helpful tutorial on how to achieve this. This resource is complete with detailed instructions and code snippets to create beautiful switches using CSS3 features.

Being a web developer, writer, and blogger for five years, Jade has a keen interest in writing about programming, coding, and web development.
Posts created 491

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top