igx-switch

November 19, 2025 ยท View on GitHub

igx-switch is a selection component that allows users to make a binary choice for a certain condition. It behaves similar to the switch component sans the indeterminate state.
A walkthrough of how to get started can be found here

Basic usage of igx-switch

<ul>
    <li *ngFor="let task of tasks">
        <igx-switch [checked]="task.done" (change)="handler($event)">
            {{ task.description }}
        </igx-switch>
    </li>
</ul>

You can easily use it within forms with [(ngModel)]

<form (submit)="saveForm()">
    <div *ngIf="order.items">
        <div *ngFor="let item of order.items">
            <ig-switch [disabled]="order.completed || order.canceled"
                       [checked]="order.completed"
                       [(ngModel)]="item.completed">
                {{ item.description }}
            </ig-switch>
        </div>
    </div>
</form>

Switch Label

The switch label is set to anything passed between the opening and closing tags of the <igx-switch> component.

The position of the label can be set to either before or after(default) the switch using the labelPosition input property. For instance, to set the label position before the switch:

<igx-switch labelPosition="before">Label</igx-switch>

Ripple Touch Feedback

The igx-switch is styled according to the Google's Material spec, and provides a ripple effect around the switch's thumb when the switch is clicked/tapped. To disable the ripple effect, do:

<igx-switch [disableRipple]="true"></igx-switch>

API Summary

NameTypeDescription
@Input() idstringThe unique id attribute to be used for the switch. If you do not provide a value, it will be auto-generated.
@Input() labelIdstringThe unique id attribute to be used for the switch label. If you do not provide a value, it will be auto-generated.
@Input() namestringThe name attribute to be used for the switch.
@Input() valueanyThe value to be set for the switch.
@Input() tabindexnumberSpecifies the tabbing order of the switch.
@Input() checkedbooleanSpecifies the checked state of the switch.
@Input() requiredbooleanSpecifies the required state of the switch.
@Input() disabledbooleanSpecifies the disabled state of the switch.
@Input() disableRipplebooleanSpecifies the whether the ripple effect should be disabled for the switch.
@Input() labelPositionstring `` enum LabelPosition
@Input("aria-labelledby") ariaLabelledBystringSpecify an external element by id to be used as label for the switch.
@Output() changeEventEmitterEmitted when the switch checked value changes.

Methods

toggle
Toggles the checked state of the switch.