Syncfusion Feedback

Trusted by the world’s leading companies

Syncfusion Trusted Companies

Overview

The React Switch component is an interactive toggle for managing on and off states. It supports multiple sizes, customizable label positions, colors, track labels, and handle icons.


React switch code example

Get started with the React Switch using just a few lines of TSX code, as shown below.

import { Switch } from '@syncfusion/react-buttons';

export default function App() {
    return (
    <Switch label='Switch' defaultChecked />
    );
}

React Switch states

Switch states

Display clear states for on, off, disabled, and read-only interactions. Use the disabled mode when changes are not permitted, and use read-only mode to show the current state without allowing edits.


Size

The React Switch supports small, medium, and large sizes to fit various UI layouts.

React Switch sizes


React Switch label

Label position

Labels can be positioned to the left, right, above, or below to add captions for switches.


Controlled mode

Manage the Switch state based on the application needs. Use controlled mode when the checked state should be handled through the app logic, or use uncontrolled mode when the Switch can manage its own state internally.


Customization

React Switch customization

Switch styles

The Switch includes predefined options for primary, success, warning, info, and error styles. It also supports customization of its user interface, including the track, handle, and overall style.

React Switch track label

Track label

Add custom text or icons to the Switch track to display additional information based on the on/off state.

React Switch handle icon

Handle icon

Customize the Switch handle by displaying different icons for the on and off states.


Form validation

Form validation

The Switch integrates seamlessly with HTML form validation, improving overall form reliability and accessibility.


Accessibility

React Switch Keyboard image

Keyboard navigation

Users can focus the Switch and press the Spacebar to toggle between the on and off states. Focus state and current toggle status are clearly indicated.

React Switch Screen Reader image

Screen reader and WAI-ARIA

The component uses the switch role with the aria-checked attribute to announce the current state (on/off) to screen readers.

React Switch Rtl image

Right-to-left (RTL) display

RTL rendering mirrors the layout for languages such as Arabic and Hebrew, adapting the visual presentation for right-to-left text direction.




Other Supported Frameworks

In addition to React, built-in integration is available for these major frameworks.

Pure React Components

Developed using React’s core principles, this library employs functional components and hooks without any external dependencies.

Frequently Asked Questions

You can find our React Switch 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.

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.

Read Our Customer Stories


Rated by users across the globe

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

Syncfusion React Switch resources

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.

Up arrow icon