UIPin
ComponentsIconsIllustrationsMotionTemplatesApps
Boards
UIPin

Free, open-source UI components, icons, illustrations, motion, templates and apps, in one search. Every item links to its source and licence.

UIPin is free. If it saved you time, you can keep it running:

Buy me a coffee
ComponentsIconsIllustrationsMotionTemplatesAppsLibrariesCompareNew this weekMCP for agentsBoardsPrivacy

Components, icons and artwork belong to their authors and are shown under their open-source licences.

Magic UI/Ripple

Backgrounds
1 of 3
Compiling

Theme it

Every preview, live

Brand colour

Corner radius

Font

Recolours shadcn’s tokens, Tailwind’s accent colours and colours set in the code. Red, amber and green classes stay, since they usually mean error, warning or success.

3 versions·2 libraries

  • Ripple
  • Eldora UI
  • Ripple Button

Ripple

An animated ripple effect typically used behind elements to emphasize them.

npx shadcn@latest add https://magicui.design/r/ripple.json
Open in v0 Docs Repo
Library
Magic UI
License
MIT
Stack
React · Tailwind CSS
Size
59 lines
Demo
From Magic UI

Code

registry/magicui/ripple.tsx

import React, { type ComponentPropsWithoutRef, type CSSProperties } from "react"

import { cn } from "@/lib/utils"

interface RippleProps extends ComponentPropsWithoutRef<"div"> {
  mainCircleSize?: number
  mainCircleOpacity?: number
  numCircles?: number
}

export const Ripple = React.memo(function Ripple({
  mainCircleSize = 210,
  mainCircleOpacity = 0.24,
  numCircles = 8,
  className,
  ...props
}: RippleProps) {
  return (
    <div
      className={cn(
        "pointer-events-none absolute inset-0 mask-[linear-gradient(to_bottom,white,transparent)] select-none",
        className
      )}
      {...props}
    >
      {Array.from({ length: numCircles }, (_, i) => {
        const size = mainCircleSize + i * 70
        const opacity = mainCircleOpacity - i * 0.03
        const animationDelay = `${i * 0.06}s`
        const borderStyle = "solid"

        return (
          <div
            key={i}
            className={`animate-ripple bg-foreground/25 absolute rounded-full border shadow-xl`}
            style={
              {
                "--i": i,
                width: `${size}px`,
                height: `${size}px`,
                opacity,
                animationDelay,
                borderStyle,
                borderWidth: "1px",
                borderColor: `var(--foreground)`,
                top: "50%",
                left: "50%",
                transform: "translate(-50%, -50%) scale(1)",
              } as CSSProperties
            }
          />
        )
      })}
    </div>
  )
})

Ripple.displayName = "Ripple"

More like this

Toolbar Dynamic

Motion Primitives·Navigation

Input Otp

shadcn/ui·Inputs & forms

Svg Ripple Effect

Eldora UI·Backgrounds

Sheet

shadcn/ui·Overlays

Striped Pattern

Magic UI·Backgrounds

Carousel

HextaUI·Media & 3D

Toolbar Expandable

Motion Primitives·Navigation

Button

shadcn/ui·Buttons

Dropdown Menu

shadcn/ui·Overlays

Grid Pattern

Magic UI·Backgrounds

Border Trail

Motion Primitives·Cursor & effects

Skeleton

shadcn/ui·Feedback & loaders

Slider

shadcn/ui·Inputs & forms

Animated Grid Pattern

Magic UI·Backgrounds

Switch

shadcn/ui·Inputs & forms