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?
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.
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.
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.
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);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With