Skip to main content

angular material - How to use Button toggle

app.component.html

<h2>Angular Material - How to use Button toggle</h2>


<div style="padding-top:25px; padding-bottom:25px;">
  <mat-button-toggle #toggleBtn>
    Toggle
  </mat-button-toggle>
</div>


<h1>{{toggleBtn.checked}}</h1>

<h1>
  Toggle button is {{
    toggleBtn.checked? 'checked/on': 'uncheked/off'
  }} now.
</h1>
app.module.ts [import]

import {MatButtonToggleModule} from '@angular/material/button-toggle';
More Angular tutorials