Components

Ripple

An animated ripple background for React: concentric rings expand from the center in a seamless, staggered loop, like a radar ping or a drop in still water. Turn on interactive mode and every click or tap sends ripples out from the pointer. Crisp SVG rings, scaled on the compositor.

  • Background
  • Seamless loop
  • Click to ripple
  • SVG
  • Pauses off-screen
  • Reduced-motion safe

Searching for devices

3 devices nearby

Installation

$ npx shadcn@latest add https://duskui.com/r/ripple.json

The rings fill and center on their nearest positioned parent, so give the parent relative and overflow-hidden, and put your content after it with relative.

Usage

nearby.tsx
import { Ripple } from "@/components/dusk/ripple/ripple"

export function Nearby() {
  return (
    <div className="relative flex h-96 items-center justify-center overflow-hidden">
      <Ripple mainCircleSize={140} numCircles={6} />
      <div className="relative">{/* your content */}</div>
    </div>
  )
}

Examples

Click to ripple

interactive listens for presses on the parent element and spawns a burst of rings at the pointer. numCircles={0} turns the center loop off; clickSize sets how far each burst travels.

Click or tap anywhere

Around an avatar

A small mainCircleSize, fewer rings, a tighter circleGap and a shorter duration make a ringing-call indicator. Size the root with a class to center the rings on part of a card.

AK

Calling Aiko…

Ringing on 2 devices

API Reference

Any other div prop is passed to the root. Rings are animated with the Web Animations API on transform and opacity only, and their strokes don't scale, so lines stay 1px at every size.

PropTypeDefaultDescription
mainCircleSizenumber140Diameter in px of the innermost ring, where rings are born.
numCirclesnumber4Rings in the loop; 0 turns the loop off.
circleGapnumber80Diameter difference in px between neighbouring rings.
colorstring"rgb(255 255 255)"Ring color. Any CSS color.
durationnumber8Seconds for one ring to travel from center to edge.
interactivebooleanfalseSpawn ripples where the pointer presses inside the parent.
clickSizenumber280Final diameter in px of a pointer ripple.
classNamestring—Merged onto the absolutely positioned root.

Accessibility

  • The ripple is decorative: it is aria-hidden and pointer-events-none. Interactive mode listens on the parent, so buttons and links on top keep working.
  • With prefers-reduced-motion the rings stay in their resting positions and presses spawn nothing.
  • The loop pauses while the ripple is off-screen or the tab is hidden.
  • Pointer ripples are visual feedback only; don't rely on them to confirm an action.