Button whose wave spreads from the press point. Hold to confirm fills it before firing; loading pulses, success morphs to a check.
Press mePress me
Expense ER-2041 · Priya N.
Team offsite, Lisbon
€1,280.00
3 receipts · within policy
pending
Submitted 2 days ago
ripple-button · , lively
ripple-button-demo.tsx
When to use
Use it where a press should feel physical and the outcome should show on the button: review queues, dialog footers, checkout. Add holdToConfirm to replace an Are you sure dialog.
When not to use
For a call to action that should catch the eye before it is touched use Shimmer Button. For async flows that return a promise use Action Button.
Use it where a press should feel physical and its outcome should be visible on the button itself:
approve and reject actions in review queues, dialog footers, checkout, touch-first back-office
screens. The wave starts under the finger, so it confirms exactly what was pressed.
Its useful twist is holdToConfirm: for actions you would otherwise guard with a confirm dialog
(reject, delete, revoke), the person presses and holds while the wave fills the button from the
press point. onClick runs only when the fill reaches the farthest corner; letting go early drains
it back. One gesture replaces "Are you sure?", and the fill shows how far along it is.
loading and success cover the request that follows: the waves turn into a slow pulse while the
server works, then the label morphs into a check. For a call to action that should catch the eye
before anyone touches it, use Shimmer Button.
The motion follows the MotionKit grammar in three beats. Pressing charges it: the button sinks
onto its shadow in 90ms with the temperament's squash, and the wave starts as a dot at the press
point. The action is the wave spreading to the farthest corner, slowing as it reaches the
edges like a ring in water; it keeps growing while you hold. On release the button springs back up
and the wave settles by fading while it finishes spreading, so a quick tap never stops dead.
holdToConfirm takes true (0.8s) or a number of seconds. While it is on:
a tap does nothing but show the fill draining back, so a slip never fires the action;
onClick (and a form submit, for type="submit") runs once, when the fill completes; the button
then springs back and the fill fades;
holding Space or Enter works the same way;
screen reader activation (a click with no press behind it) fires at once, because assistive tech
cannot hold. The button is described by holdHint ("Press and hold to confirm" by default; make
it specific: "Press and hold to delete staging-eu").
Put the gesture in the label ("Hold to delete") so it is evident without instructions.
loading pulses two waves from the center, sets aria-busy and ignores presses; success swaps
the label for a check and successText with one wave from the center. Both keep the button
focusable (aria-disabled) and block onClick. All labels share one grid cell, so the button is
always as wide as the widest of children, loadingText and successText: no layout shift.
Without successText the check stands alone and the button keeps its label as accessible name.
ink (default): a solid button in your theme's primary, with a soft fill wave.
glow: the --brand color with a tinted glow; the wave is bright and also lights the rim
where it crosses the border.
outline: a bordered surface; the wave is a thin ring with a faint fill behind it.
destructive: your theme's destructive with white text, for deletes; pair it with
holdToConfirm.
The hold fill always pushes the surface away from the label color, so text contrast grows while the
button fills. Explicit props win over the preset: rippleColor replaces the wave and fill color,
rippleDuration how long a wave takes to cross the button, centered starts every wave from the
middle (useful for icon buttons). Use asChild to render a link with the same styles (labels for
loadingText and successText need the default <button>).
<RippleButton temperament="calm">Pay €24</RippleButton><RippleButton preset="destructive" holdToConfirm={1.2}>Hold to revoke</RippleButton><RippleButton asChild centered size="sm"> <a href="/docs">Read the docs</a></RippleButton>
Payments and forms with errors should use temperament="calm": the press stays firm and never
bounces.
A native <button> (or your element with asChild) with a visible focus ring and the disabled
state handled for you. Sizes are 32, 40 and 48px tall.
Waves are decorative and aria-hidden. They sit under the label and stay faint under light
labels, so text keeps AA contrast in every frame in both themes.
Keyboard presses get the same feedback as the pointer: the wave starts from the center.
loading sets aria-busy and aria-disabled; success sets aria-disabled. The button keeps
focus, and its accessible name follows the visible label. Announce the result in a live region
next to it (the demos use role="status").
holdToConfirm adds aria-describedby with holdHint and lets screen reader activation through
without a hold. On touch, the long press does not open the context menu.
Right clicks and other secondary buttons make no wave.
With reduced motion (the OS setting or MotionKitProvider reducedMotion="always") there is no
wave, sink or squash: a press tints the whole surface in 120ms and fades when released, a hold
fills that tint in place over the hold time, loading shows a still tint and labels crossfade
without moving. The button still clicks and confirms exactly as before.
Each wave animates only transform and opacity of one or two absolutely positioned circles
that share one pair of motion values, so fill, ring and rim light move on a single timeline.
At most six waves exist at once; each removes itself when it has faded. Nothing runs while the
button is idle.
The loading pulse stops off screen and in hidden tabs.
The press is a transform on the button; no layout shifts.
Technical sheet
Motion
calm
260 ms · bounce 0
lively
400 ms · bounce 0.3
playful
540 ms · bounce 0.45
Main spring of each temperament. Set it with the temperament prop or MotionKitProvider; the default is lively.
Size
Not measured yet · budget 15.0 kB gzip
Component and MotionKit helpers; excludes react, react-dom, @radix-ui/react-slot, motion.
Dependencies
@radix-ui/react-slot · peer
motion · peer
Triggers
press, click
Reduced motion
No wave, sink or squash: presses tint the whole surface for 120ms, a hold fills the tint in place, loading shows a still tint.
Keyboard
Tab
Moves focus to the button
Space / Enter
Presses the button: a wave spreads from the center while the key is down
Hold Space / Enter
With holdToConfirm, fills the button and fires when the fill completes; releasing early cancels
Browsers
Last 2 versions of Chrome, Edge, Firefox and Safari (iOS 16.4+)