Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable mat-icon-button hover background-color?

Is it possible to disable the default state of hover on a mat-icon-button? I want to apply a custom hover effect on this button, but can't get rid of the default effect as it's still visibly there

<button mat-icon-button>
    <mat-icon>minimize</mat-icon>
</button>

Tried couple of methods by setting the background-color on transparent on hover state, adding the !important tag, but nothing seemed to work.

.mat-icon:hover {
  background-color: transparent;
.mat-mdc-icon-button:hover {
  background-color: transparent;

1 Answers

You have to override mat-mdc-button-persistent-ripple::before this.

.mat-mdc-icon-button:hover .mat-mdc-button-persistent-ripple::before {
  opacity: 1;
  background-color: red;
}

Example :

https://stackblitz.com/edit/4splr1?file=src%2Fexample%2Fbutton-overview-example.css

like image 193
OMANSAK Avatar answered Dec 14 '25 06:12

OMANSAK



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!