app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styles: [`
:host ::ng-deep
.mat-slide-toggle.mat-checked:not(.mat-disabled)
.mat-slide-toggle-bar {
background-color: MediumSeaGreen ;
}
:host ::ng-deep
.mat-slide-toggle.mat-checked:not(.mat-disabled)
.mat-slide-toggle-thumb {
background-color: SeaGreen ;
}
`]
})
export class AppComponent { }
app.component.html
<h2 style="padding-top:25px; padding-bottom:25px;">
Angular Material - How to change Slide toggle checked color
</h2>
<h3>Checked status : {{slideToggle.checked}}</h3>
<mat-slide-toggle #slideToggle>
Allow file access
</mat-slide-toggle>
app.module.ts [import]
import { MatSlideToggleModule } from '@angular/material/slide-toggle'
- angular material - How to use Badge with text
- angular material - How to change Badge size
- angular material - How to use custom Badge size
- angular material - How to show custom color in Badge
- angular material - How to show Badge in a button
- angular material - How to show Badge with icon
- angular material - Badge position before & below after
- angular material - Open Accordion multiple panels at once
- angular material - How to disable a panel in Accordion
- angular material - How to hide Accordion panels toggle icon
- angular material - Icon inside Expansion Panel header
- angular material - Show Accordion toggle icon on left
- angular material - Open & close Accordion all panels at once
- angular material - Determine an Expansion Panel is disabled or enabled
- angular material - How to toggle Expansion Panel expanded state