Material Ripple Button
Google Material Design inspired ripple effect on click
Embed this component
Paste this snippet into any site — the design renders in a sandboxed iframe served from /embed/ripple-button.
<iframe src="/embed/ripple-button" sandbox="allow-scripts" loading="lazy" title="Material Ripple Button" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>Implementation code
Copy the HTML and CSS for Material Ripple Button, or grab a framework-specific implementation. The HTML and CSS variants are self-contained; framework variants assume that framework's project setup.
HTML
<button class="ripple-button">
<span>Click Me</span>
</button>CSS
.ripple-button {
position: relative;
padding: 1rem 2rem;
border-radius: 0.5rem;
background: #2563eb;
color: white;
font-weight: 600;
border: none;
cursor: pointer;
overflow: hidden;
transition: background 0.3s ease;
}
.ripple-button:hover {
background: #1d4ed8;
}
.ripple-button::after {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 0;
height: 0;
border-radius: 50%;
background: rgba(255, 255, 255, 0.5);
transform: translate(-50%, -50%);
transition: width 0.6s, height 0.6s;
}
.ripple-button:active::after {
width: 300px;
height: 300px;
}LWC — HTML template
<template>
<button class="ripple-button" onclick={handleClick}>
<span><slot>Click Me</slot></span>
</button>
</template>LWC — JavaScript
import { LightningElement, api } from 'lwc';
export default class RippleButton extends LightningElement {
@api label = 'Click Me';
handleClick() {
this.dispatchEvent(new CustomEvent('buttonclick', {
bubbles: true,
composed: true
}));
}
}LWC — CSS
.ripple-button {
position: relative;
padding: 1rem 2rem;
border-radius: 0.5rem;
background: #2563eb;
color: white;
font-weight: 600;
border: none;
cursor: pointer;
overflow: hidden;
transition: background 0.3s ease;
}
.ripple-button:hover {
background: #1d4ed8;
}
.ripple-button::after {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 0;
height: 0;
border-radius: 50%;
background: rgba(255, 255, 255, 0.5);
transform: translate(-50%, -50%);
transition: width 0.6s, height 0.6s;
}
.ripple-button:active::after {
width: 300px;
height: 300px;
}LWC — Configuration
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
<target>lightning__HomePage</target>
</targets>
</LightningComponentBundle>Where Material Ripple Button fits
- Material UI
- Android Apps
- Modern Web Apps
- Forms
Interaction states & animations
- Ripple
- Pressed
Topics
- #material
- #ripple
- #click
- #wave
- #interactive
Accessibility notes
Ensure ripple doesn't interfere with focus indicators. Provide keyboard alternative.
Browser support
- All modern browsers