We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Trusted by the world’s leading companies

Syncfusion Trusted Companies


The JavaScript Toggle Switch Button control is a custom HTML5 input-type checkbox control that allows you to perform a toggle (on/off) action between checked and unchecked states. It supports different sizes, labels, label positions, and UI customization.

Toggle ON-OFF States

A single switch consists of a toggle state that can be checked and unchecked. To prevent the toggling of switch value, you can make use of disable option.

Change Switch Size

In JavaScript Toggle Switch Button, you can make use of different switch sizes, default and small, as required in your application.

Custom Switch labels, colors and width

The appearance of the JavaScript Toggle Switch Button control (bar and handle) can be fully customized. A switch can contain text to represent checked/unchecked states (ON/OFF). The look and feel of the switch can be changed to

  • Windows Switch
  • iOS Switch
  • Android Switch

Forms support

The JavaScript Toggle Switch Button seamlessly supports HTML forms, template-driven forms (Angular), and reactive forms.

Other supported frameworks

The Toggle Switch Button control is also available in Blazor, React, Angular, and Vue frameworks. Check out the different Toggle Switch Button platforms from the links below,

Built-in themes

The HTML5/JavaScript Toggle Switch Button supports built-in themes such as Bootstrap 5, Tailwind CSS, Fluent, high contrast, and more. Users can customize these built-in themes or create new themes to achieve the desired look and feel either by simply overriding SASS variables or using the Theme Studio application.

HTML5 Switch Button In Various Themes

Web Accessibility

  • Fully supports WAI-ARIA accessibility to work with on-screen readers and assistive devices.
  • Follows WAI-ARIA best practices for implementing keyboard interaction.
  • In Switch, Space key toggle states between checked and unchecked.
  • The UI element visuals such as foreground color, background color, line spacing, text, and images are designed based on WCAG 2.0.
  • The Toggle Switch Button supports right-to-left (RTL) text direction for users working in right-to-left languages like Hebrew, Arabic, or Persian.

JavaScript Toggle Switch Button Code Example

Easily get started with the JavaScript Toggle Switch Button using a few simple lines of HTML and TS code, as demonstrated below. Also explore our JavaScript Toggle Switch Button Example that shows you how to render and configure the Toggle Switch Button in JavaScript.

    <!--element which is going to render-->
    <input id="element" type="checkbox"/>
import { Switch } from '@syncfusion/ej2-buttons';

// Initialize Switch component with checked state.
let switchObj: Switch = new Switch({ checked: true });

// Render initialized Switch.


Frequently Asked Questions

The Syncfusion JavaScript Switch provides the following features:

  • Toggling between checked and unchecked states.
  • Support for different sizes, labels, and label positions.
  • Rich UI interaction and UI customization.
  • Simple configuration and API.
  • Supports all modern browsers.
  • Touch-friendly and responsive UI.
  • One of the best JavaScript Toggle Switch Button in the market that offers feature-rich UI to interact with the software.
  • Extensive demos and documentation to learn quickly and get started with JavaScript Toggle Switch Button.

You can find our JavaScript Toggle Switch Button demo here.

No, this is a commercial product and requires a paid license. However, a free community license is also available for companies and individuals whose organizations have less than $1 million USD in annual gross revenue, 5 or fewer developers, and 10 or fewer total employees.

A good place to start would be our comprehensive getting started documentation.

Our Customers Love Us

Having an excellent set of tools and a great support team, Syncfusion reduces customers’ development time.
Here are some of their experiences.

Rated by users across the globe

Transform your applications today by downloading our free evaluation version
Download Free Trial No credit card required.


Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion is proud to hold the following industry awards.

Up arrow icon
Live Chat Icon For mobile