app.component.html
<h2>Angular Material - Icon only Button toggle</h2>
<div style="padding:25px; background-color:lightgray;">
<h3>Appearance Standard (Default)</h3>
<mat-button-toggle
#toggleWifi
appearance="standard">
<mat-icon>
{{toggleWifi.checked? 'wifi' : 'wifi_off'}}
</mat-icon>
</mat-button-toggle>
<h1 style="padding:25px;">
Wifi is now {{toggleWifi.checked? 'on' : 'off'}}.
</h1>
</div>
<div style="padding:25px; background-color:lightgray;">
<h3>Appearance Legacy</h3>
<mat-button-toggle
#toggleLocation
appearance="legacy">
<mat-icon>
{{toggleLocation.checked? 'edit_location' : 'location_off'}}
</mat-icon>
</mat-button-toggle>
<h1 style="padding:25px;">
Location is now {{toggleLocation.checked? 'on' : 'off'}}.
</h1>
</div>
app.module.ts [import]
// for material icon
import {MatIconModule} from '@angular/material/icon';
// for material toggle button
import {MatButtonToggleModule} from '@angular/material/button-toggle';
- angular material - Button toggle group appearance
- angular material - How to set Button toggle appearance
- angular material - Button toggle group icon only
- angular material - Vertical Button toggle group
- angular material - How to use vertical Slider
- angular material - How to change Slider width
- angular material - Tick interval auto in Slider
- angular material - How to show thumb label in Slider
- angular material - Slider custom formatted thumb label
- angular material - How to use Slider change event
- angular material - How to get Slide toggle checked status
- angular material - How to change Slide toggle label position
- angular material - How to use Slide toggle change event
- angular material - How to use custom Badge size
- angular material - How to show custom color in Badge