Documentation Index
Fetch the complete documentation index at: https://mintlify.com/angular/components/llms.txt
Use this file to discover all available pages before exploring further.
Overview
<mat-slide-toggle> is an on/off control that can be toggled via clicking. The slide toggle behaves similarly to a checkbox, but doesn’t support an indeterminate state like <mat-checkbox>.
Basic Usage
- Template
- Reactive Forms
API Reference
MatSlideToggle
Selector:mat-slide-toggle
Exported as: matSlideToggle
Inputs
Whether the slide toggle is checked.
Whether the slide toggle is disabled.
Whether the slide toggle has a ripple.
Theme color of the slide toggle. This API is supported in M2 themes only.
Whether the label should appear after or before the slide toggle. Defaults to ‘after’.
Whether the slide toggle is required.
Name value will be applied to the input element if present.
A unique id for the slide toggle input. If none is supplied, it will be auto-generated.
Tabindex of slide toggle.
Whether to hide the icon inside of the slide toggle.
Whether the slide toggle should remain interactive when it is disabled.
Used to set the aria-label attribute on the underlying input element.
Used to set the aria-labelledby attribute on the underlying input element.
Used to set the aria-describedby attribute on the underlying input element.
Outputs
An event is dispatched each time the slide toggle changes its value.
An event is dispatched each time the slide toggle input is toggled. This event is always emitted when the user toggles the slide toggle, but does not mean the slide toggle’s value has changed.
Methods
Focuses the slide toggle.
Toggles the checked state of the slide toggle.
MatSlideToggleChange
The source slide toggle of the event.
The new
checked value of the slide toggle.Accessibility
- The slide toggle uses a native checkbox input under the hood
- The component supports keyboard interaction (Space to toggle)
- Use
aria-labeloraria-labelledbywhen the slide toggle doesn’t have a visible label - Disabled slide toggles are not focusable and are announced as disabled to screen readers
- The checked state is announced to screen readers