Docs
Ripple Button

Ripple Button

A button with a ripple effect.

components/snippet/ripple-button.tsx

Installation

Copy and paste the following code into your project.
Update the import paths to match your project setup.
Update tailwind.config.js

Add the following animations to your tailwind.config.js file:

tailwind.config.js
/** @type {import('tailwindcss').Config} */
// tailwind.config.js
module.exports = {
  theme: {
    extend: {
      animation: {
        rippling: "rippling 400ms ease-out",
      },
      keyframes: {
        rippling: {
          "0%": {
            opacity: "1",
          },
          "100%": {
            transform: "scale(2)",
            opacity: "0",
          },
        },
      },
    },
  },
};

Props

PropTypeDescription
childrenReact.ReactNodeThe content of the button.
classNamestringAdditional class names for the button.
rippleColorstringThe rbg numbers only for the color of the rippling waves.
durationstringThe time span of one ripple.