Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular4 Change md-button's ripple color

I have created a md-button in my webpage using Material for Angular4. Is there a way to change the ripple effect's color and make it white? Can I also change other ripple properties, like the duration of the ripple effect?

like image 901
Stefanos P Argyriou Avatar asked Sep 24 '17 00:09

Stefanos P Argyriou


People also ask

How to disable ripple effect in ANGULAR?

The animation of ripples can be disabled by using the animation global option. If the enterDuration and exitDuration is being set to 0 , ripples will just appear without any animation.

What is ripple material?

A Ripple is a Material implementation of Indication that expresses different Interaction s by drawing ripple animations and state layers. A Ripple responds to PressInteraction.

How do you remove mat button from Ripple?

Set a mat-button to disable ripple effect using [disableRipple]="true" . Open Chrome or Safari's devTools and go to Layers panel. Inspect the button and see that its ripple is present, and is elevated to its own layer.


1 Answers

It turned out that in order to change the ripple properties, one should create a mixin at the mat-ripple-theme and import it in their app's styles.scss file:

@import '~@angular/material/theming';

@mixin mat-ripple-theme($theme) {
  .mat-ripple-element {
    background-color: rgba(255, 255, 255, .4);
  }
}
like image 147
Stefanos P Argyriou Avatar answered Oct 31 '22 20:10

Stefanos P Argyriou