Ripple Button

Material-style ripple that spreads outward on press, built with pure CSS.

Tailwind CSS
<button class="group relative overflow-hidden rounded-xl bg-indigo-600 px-6 py-3 font-semibold text-white transition active:scale-95">
  <span class="absolute left-1/2 top-1/2 h-6 w-6 -translate-x-1/2 -translate-y-1/2 scale-0 rounded-full bg-white/40 transition-transform duration-700 ease-out group-active:scale-[20]"></span>
  <span class="relative">Click me</span>
</button>

Free to use in personal and commercial projects. No attribution required.

Variants

Same component, different looks. Preview each one live and copy the code you like.

Emerald

Use the emerald version for positive actions like signup or checkout where green signals go.

Tailwind CSS

Outline

The outline style suits secondary actions that should not compete with the primary button.

Tailwind CSS

Dark

The dark version fits footers, navbars, and minimal layouts that need a strong neutral CTA.

Tailwind CSS

Where to use it

  • ✓ Primary form submit buttons that need clear press feedback
  • ✓ Add-to-cart and checkout CTAs in mobile-first stores
  • ✓ Icon buttons in toolbars where hover states do not exist on touch
  • ✓ Call-to-action buttons inside cards and pricing tables

About this ripple button

The ripple button recreates the Material Design press effect everyone recognizes from Android apps: tap the button and a soft circle blooms outward from the center, then fades. It gives instant tactile feedback that the press registered, which makes interfaces feel responsive even on slow networks.

The trick is pure CSS with no JavaScript. A small white circle sits absolutely centered inside the button, scaled down to zero. The button carries the group class, so group-active:scale-[20] on the circle fires while the button is pressed, scaling the dot up twenty times until it floods the button. overflow-hidden on the button clips the circle into a clean ripple, and the label sits in a relative span above it.

Use it on primary actions where feedback matters: submit buttons, add-to-cart, or any CTA inside a form. Keep the ripple color as a translucent white on dark buttons and a translucent dark tint on light buttons so it reads as light spreading, not a stain.

On touch screens there is no physical key traveling downward, so a tap can feel like shouting into a void. Users tap, nothing seems to happen for 200 milliseconds, and they tap again, which is how double orders and duplicate posts are born. Material Design answered this with the ripple: a circle blooming from the touch point, the visual equivalent of a keypress. This element brings that feedback to any web button with zero JavaScript.

The button carries group, relative, and overflow-hidden. Inside sits a 24px white circle, absolutely centered with translate utilities and parked at scale-0. While the button is pressed, group-active:scale-[20] fires and the circle grows twentyfold over 700 milliseconds with an ease-out curve, flooding the button before being clipped into a clean ripple by the overflow. The label is wrapped in a relative span so it paints above the flood.

The same trick works on anything clickable, not just buttons. Add group relative overflow-hidden to a list row, a card, or a nav link, drop in the ripple span, and the whole surface blooms on press. On dark surfaces keep the white ripple; on light buttons switch it to a dark tint so the bloom stays visible. For icon-only buttons, lower the scale value so the ripple matches the smaller area instead of overshooting it.

The common disappointment is expecting a full bloom-and-fade like native Material, then seeing the ripple vanish the instant the mouse button lifts. That happens because group-active only applies while the press is held, so a fast click barely shows the effect. This is the deliberate trade for a zero-JS implementation. If you need the ripple to finish its animation after release, or to originate exactly at the click point, that requires JavaScript to spawn and remove spans.

Frequently asked questions

Does this need JavaScript?

No. The ripple is driven by the group-active variant, which maps to the CSS :active pseudo-class. Press and hold the button and the circle scales up; release and it snaps back.

Why does the ripple start from the center instead of my click point?

A pure CSS version cannot know the click coordinates, so it radiates from the center. If you need the ripple to originate exactly where the user tapped, add a small JavaScript handler that positions the span at the click point before scaling it.

Does this work on touch devices?

Yes. Mobile browsers fire :active on tap, so the ripple plays on phones and tablets. That is exactly why this pattern is popular in mobile-first interfaces.

How do I change the ripple color?

The ripple is a separate absolutely positioned span, so give it its own background color. On light buttons use a dark tint like black at 15% opacity, and on dark or colored buttons use white at 30% opacity so the ripple reads clearly. Avoid a fully opaque color, it will hide the label while it expands.

Can I make a ripple button with CSS only?

Yes, for a simple version you can use the :active pseudo-class to scale a centered circle up and fade it out, no JavaScript needed. The trade-off is the ripple always starts from the center. If you want it to burst from the exact click point, this element uses a small script to read the pointer coordinates and position the ripple there.

How do I add a ripple effect to a button in React?

Keep a click coordinate in state and render the ripple span at that position inside a relative, overflow-hidden button. On animation end, clear the state so the next click can spawn a fresh ripple. Reset the key or re-add the class each time, otherwise the animation will not replay on the second click.

Design notes

When to use

The ripple gives touch users the confirmation that their tap landed, which is why it feels at home in mobile-first interfaces following Material conventions. The expanding circle originates from the press point, tying the feedback directly to the user's finger. It works best on primary buttons where the action matters enough to deserve a little ceremony.

What to avoid

Do not put ripples on every tiny control, the effect loses meaning when the whole interface is splashing. Avoid slow ripples that linger after the action completed, feedback should be quick, not a show. And do not use a ripple as the only press feedback on a button that also needs a loading state, they solve different moments.

Accessibility

The ripple is pure decoration, so it must not trap focus or add noise for screen readers. Keep the visible focus ring intact, since the ripple alone does not indicate keyboard focus.

Customization tips

Change bg-white/40 to any translucent color to match your button, for example bg-black/20 on light buttons. Adjust duration-700 for a faster or slower spread, and scale-[20] controls how far the ripple travels before the press ends.

Customize it with our tools