Martin Staufcik
Martin Staufcik

Reputation: 9490

Material Design ripple effect on other element than button

I wonder, would it be possible to reuse the Material Design CSS ripple effect on other HTML element than button, for example a div? Or would it be easier to create own ripple effect in CSS?

Upvotes: 1

Views: 581

Answers (1)

LordSilvermort
LordSilvermort

Reputation: 277

Material Design provides a ripple component out of the box, it can be used like this:

In .ts file:

import {MatRippleModule} from '@angular/material/core';

In view:

<div matRipple [matRippleColor]="myColor"> 
 <ng-content></ng-content> 
</div> 

Examples and more information about the component can be found here: https://material.angular.io/components/ripple/overview

Upvotes: 1

Related Questions