JavaScript Toggle Switch Button - HTML5 ON-OFF Switch Control
- Fully customizable UI with checked and unchecked states.
- Customize the label content with built-in API’s.
- Comes with industry standard themes-Material, Fabric and Bootstrap.
Trusted by the world’s leading companies

Overview
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.

Web Accessibility
- Fully supportsWAI-ARIA accessibility to work with on-screen readers and assistive devices.
- FollowsWAI-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 onWCAG 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 ourJavaScript Toggle Switch Button Example that shows you how to render and configure the Toggle Switch Button in JavaScript.
Not sure how to create your first JavaScript Toggle Switch Button? Our documentation can help.
I’d love to read it now145+ JAVASCRIPT UI CONTROLS
Frequently Asked Questions
✅ Why should you choose Syncfusion JavaScript Toggle Switch Button?
The Syncfusion JavaScript Switch provides the following features:
- Toggling between checked and unchecked states.
Support fordifferent 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.
Extensivedemos anddocumentation to learn quickly and get started with JavaScript Toggle Switch Button.
✅ Where can I find the Syncfusion JavaScript Toggle Switch Button demo?
You can find our JavaScript Toggle Switch Button demohere.
✅ Can I download and utilize the Syncfusion JavaScript Toggle Switch Button for free?
No, this is a commercial product and requires a paid license. However, afree 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.
✅ How do I get started with Syncfusion JavaScript Toggle Switch Button?
A good place to start would be our comprehensivegetting started documentation.
Our Customers Love Us






See Real Success Stories
Developers around the world trust Syncfusion’s Essential Studio to simplify complex projects and speed up delivery. With a vast library of UI controls, powerful SDKs, and reliable support, Essential Studio helps teams build enterprise-ready applications with confidence.
Explore Case StudiesIndustry
Software development
75% Cost reduction
50% Faster development
Industry
Utilities (oil and gas)
450+ hours saved
Streamlined processes and hours of development effort saved.
Advanced, flexible features
Empowered users through robust and versatile functionality.
Industry
Software and technology
1000+ of hours saved
Accelerated development with enterprise-ready UI components.
Efficient file management
Streamlined workflows with document libraries without building them from scratch.
Industry
Software and technology
2 Years of delay avoided
Two years of delays prevented with proactive planning.
On-time delivery
Projects delivered on schedule using trusted controls.
Industry
IT services and IT consulting
Improved performance
Large datasets handled with easy customization and quick debugging.
Highly customizable
Plug-and-play controls with quick template integration.
Industry
Professional services
Instant access
Quick availability of features and resources.
Reduced dependencies
Fewer dependencies for faster development.
Rated by users across the globe
Transform your applications today by downloading our free evaluation version Download Free TrialNo credit card required.
Awards
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.




