Angular Toggle Switch Button | ON-OFF Switch | Syncfusion

Overview

The Angular Toggle Switch Button component is a custom HTML5 input-type checkbox component 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

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 Angular Toggle Switch Button component (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

Seamlessly supports HTML forms, template-driven forms (Angular), and reactive forms.


Angular Toggle Switch Button Example

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

<div class="control-section">
<ejs-switch [checked]="true"></ejs-switch>`
</div>
import { Component, Inject, ViewEncapsulation } from '@angular/core';
import { SwitchModule } from '@syncfusion/ej2-angular-buttons';

@Component({
    selector: 'control-content',
    templateUrl: 'default.html',
    encapsulation: ViewEncapsulation.None
})
export class DefaultToggleSwitchButtonController {

    }


Angular version compatibility

With continuous improvement in Angular versions, the Angular Toggle Switch Button is kept up to date to make it compatible with the latest version.


Built-in themes

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

Angular Toggle 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.



Transform your applications today by downloading our free evaluation version

Syncfusion Angular Resources