ToggleButton

ToggleButton is used to select a boolean value using a button.

Two-way binding to a boolean property is defined using the standard ngModel directive.

Off

Two-way binding to a boolean property is defined using the standard ngModel directive.

Off
basic-demo

Icons and Labels can be customized using onLabel, offLabel, onIcon and offIcon properties.

Unlocked
customized-demo

ToggleButton provides small and large sizes as alternatives to the base.

OffOffOff
sizes-demo

The fluid prop makes the component take up the full width of its container when set to true.

Off
fluid-demo

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

No
disabled-demo

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

No
invalid-demo
Reject All
template-driven-forms-demo

ToggleButton can also be used with reactive forms. In this case, the formControlName property is used to bind the component to a form control.

Reject All
reactive-forms-demo

Screen Reader

ToggleButton component uses an element with button role and updates aria-pressed state for screen readers. Value to describe the component can be defined with ariaLabelledBy or ariaLabel props, it is highly suggested to use either of these props as the component changes the label displayed which will result in screen readers to read different labels when the component receives focus. To prevent this, always provide an aria label that does not change related to state.

Keyboard Support

KeyFunction
tabMoves focus to the button.
spaceToggles the checked state.
ON THIS PAGE
Templates
Highly customizable application templates to get started in no time with style. Designed and implemented by PrimeTek.
Learn More