Ripple Surface
Setup
Usage
Wrap any card. By default a ripple starts wherever the card is pressed. Give the wrapper the same corner radius as the card so the glint follows its edge.
Investor update
Draft · edited 2 min ago
Q3 at a glance
Volume grew 38% this quarter, driven by faster settlement and two new payout partners.
+38%
Volume
1.2s
Settle
$0.002
Avg fee
import { RippleSurface } from "@/components/ui/ripple-surface"
export function Card() {
return (
<RippleSurface accent="#40d9bf" className="rounded-3xl">
<div className="rounded-3xl border bg-white p-6 dark:bg-neutral-900">Tap anywhere</div>
</RippleSurface>
)
}It works on light and dark cards. With tone="auto" it reads the card's background when the
effect starts: on dark cards the echo glows and the glint is bright silver, on light cards the
echo tints the text edges and the glint turns to dark chrome.
To tie the effect to an action, set trigger="none" and drive it through a ref: ripple from
the button press, then run the glint once the action succeeds.
const surface = useRef<RippleSurfaceHandle>(null)
<RippleSurface ref={surface} trigger="none" className="rounded-3xl">
<button
onPointerDown={async (e) => {
surface.current?.rippleFromEvent(e)
await pay()
surface.current?.glint()
}}
>
Confirm payment
</button>
</RippleSurface>The ripple is an SVG displacement filter applied to the real DOM, so text stays selectable. The filter is only attached while the ripple plays. On touch devices and low-end hardware it uses a single displacement pass at 30 fps without the accent echo. The glint is a rotating gradient masked to the border, animated with transforms only.
Props
| Prop | Type | Default | Notes |
|---|---|---|---|
trigger | "press" | "none" | "press" | Ripple on every press, or only when called through the ref. |
accent | string | "#8c6bff" | Hex colour of the echo that trails the ripple. |
tone | "auto" | "light" | "dark" | "auto" | Light or dark styling for the echo and glint. Auto reads the card's background. |
intensity | number | 26 | How far the ripple pushes pixels, in px. |
duration | number | 950 | Length of the ripple in ms. |
className | string | On the wrapper. Set the corner radius here. | |
surfaceClassName | string | On the inner layer that the filter distorts. |
Ref
| Method | Notes |
|---|---|
ripple(x?, y?) | Start a ripple at a point inside the card. Defaults to the centre. |
rippleFromEvent(event) | Start a ripple where a pointer event happened. |
glint() | Run the metallic glint around the border once. |
Accessibility
- The ripple and glint are decorative; the glint is
aria-hiddenand ignores the pointer - With
prefers-reduced-motion, neither the ripple nor the glint runs - Content inside stays real DOM: readable, focusable and selectable