Ripple Effect is a lightweight JavaScript library for adding Material Design-inspired ripple effects to DOM elements
Provides simple, customizable visual interactions, with no dependencies.
Add the data-ripples attribute to apply the effect:
| Attribute | Effect |
|---|---|
| data-ripples | Applies the effect to the element |
| data-ripples="light" | Sets the effect color to white |
| data-ripples="dark" | Sets the effect color to black |
Select the .ripple class inside an element with the data-ripples attribute. Every element with that attribute will follow this pattern.
[data-ripples] .ripple {
background-color: #a3eeff;
opacity: 0.32;
}Give your custom class a name and select the .ripple class inside it.
.ripples-blue .ripple {
background-color: #e2a2ff;
opacity: 0.32;
}Install with npm:
npm install @gabrielfins/ripple-effectAnd import it in your code:
import '@gabrielfins/ripple-effect';- Go to the project's github
- Download the latest release
- Add the
ripples.jsfile from the/distfolder to your project - Import the file in your HTML with:
<script src="./your-path/ripples.js" defer></script>