Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I disable/remove ion-ripple effect in ion-button Ioinic 4?

I need to disable the default ion-ripple-effect in the `ion-button'.

<ion-button>
  <ion-icon slot="icon-only" name="star"></ion-icon>
</ion-button>

enter image description here

I can't disable the pointer-events as I need it.

PS: I've referred the following posts and could not find a proper solution for Ionic 4.

  1. How to remove click effect of an ion-item
  2. Disable ripple effect on element
like image 282
Sebin Benjamin Avatar asked Oct 13 '19 08:10

Sebin Benjamin


2 Answers

--ripple-color CSS variable could be used to turn off the ripple effect.

 <ion-button class="no-ripple">
   <ion-icon slot="icon-only" name="trash"></ion-icon>
 </ion-button>

For example, we could set --ripple-color: transparent on the button, to effectively disable the effect.

.no-ripple {
  --ripple-color: transparent;
}

Refer https://github.com/ionic-team/ionic/issues/19648

like image 61
Sebin Benjamin Avatar answered Sep 26 '22 22:09

Sebin Benjamin


Just set mode to iOS

<ion-button mode='ios'>
like image 32
Fabiano Albernaz Avatar answered Sep 26 '22 22:09

Fabiano Albernaz