Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

style the focus state of an angular mat-slide-toggle

Tags:

sass

angular

What class do I use to style the focus state of a mat-slide-toggle?

From what I can tell via Inspect in the browser it might be something like ::ng-deep .mat-ripple-element .mat-slide-toggle-persistent-ripple but that's not working. I've tried a couple variations of ripple but I can't seem to find the right one, if I'm even looking in the right direction.

What I want is to recolor and shrink the diameter of the pink circle below, I just can't figure out how to select it for the SASS.

mat slide toggle

HTML:

<mat-slide-toggle (change)="onChange($event)">{{ variable-here }}</mat-slide-toggle>
like image 681
Alex Avatar asked Nov 07 '22 19:11

Alex


1 Answers

I am assuming your component is an encapsulated component...

$primary-color: #2eb66fl
:host{
/deep/ .mat-slide-toggle.mat-checked .mat-slide-toggle-bar {
  background-color: rgba($primary-color, 0.54);
}
/deep/ .mat-slide-toggle.mat-checked .mat-slide-toggle-thumb {
 background: $primary-color;
}

below code is to style ripple.

/deep/ .mat-slide-toggle.mat-checked .mat-ripple-element {
    background-color: $primary-color;
    }    
   }

enter image description here

like image 196
Zeeshan Avatar answered Nov 15 '22 07:11

Zeeshan