ToggleSwitch

ToggleSwitch is used to select a boolean value.

PREVIEW

Toggles a boolean setting between enabled and disabled states.

basic-demo

A controlled ToggleSwitch manages the checked state with ngModel and handles the change event manually.

controlled-demo

The handle template is available to display custom content.

template-demo

ToggleSwitch supports customization through the pt property. The appearance, including colors and other visual properties, can be modified by applying custom classes.

customization-demo

The invalid state is applied using the ⁠invalid property to indicate failed validation, which can be integrated with Angular Forms.

invalid-demo

When disabled is present, the element cannot be edited and focused.

disabled-demo
signal-forms-demo
template-driven-forms-demo
reactive-forms-demo

Screen Reader

InputSwitch component uses a hidden native checkbox element with switch role internally that is only visible to screen readers. Value to describe the component can either be provided via label tag combined with inputId prop or using ariaLabelledBy, ariaLabel props.

Keyboard Support

KeyFunction
tabMoves focus to the switch.
spaceToggles the checked state.