Components

Pulsating Button

A React pulsating button that sends out soft expanding rings to draw attention to a call to action. Built on the DuskUI Button with Motion and Tailwind CSS: the pulse pauses on hover and keyboard focus, stops off-screen, and every variant, size and the loading state keep working.

  • Built on DuskUI Button
  • Any pulse color
  • Pauses on hover & focus
  • No layout shift
  • prefers-reduced-motion

Installation

$ npx shadcn@latest add https://duskui.com/r/pulsating-button.json

Builds on the DuskUI Button; the CLI installs it automatically. Installing by hand? Add components/ui/button.tsx from the Button page first.

Usage

waitlist-cta.tsx
import { PulsatingButton } from "@/components/dusk/pulsating-button/pulsating-button"

export function WaitlistCta() {
  return <PulsatingButton size="lg">Join the waitlist</PulsatingButton>
}

Examples

Colors, speed & spread

pulseColor takes any CSS color, duration sets the seconds per ring and spread how far the rings travel. Works with every Button variant and size.

Loading

loading comes from the base Button: the label crossfades to a spinner without changing the width, and the rings fade out with it.

API Reference

Also accepts every DuskUI Button prop (variant, size, loading, loadingText, loaderIcon) except asChild.

PropTypeDefaultDescription
pulseColorstringvar(--color-primary)Any CSS color for the rings.
durationnumber2.4Seconds for one ring to expand and fade. A second ring follows half a beat later.
spreadnumber8How far the rings travel outwards, in px.
classNamestring—Merged with tailwind-merge, so overrides win.

Accessibility

  • Renders a native <button>, so Enter, Space and focus order work as usual, with the standard focus-visible ring.
  • The pulse fades out on hover and on focus, so it never competes with the focus ring or distracts while the user is about to act.
  • Rings are an outer box-shadow on an aria-hidden layer, so they take up no space and never reach screen readers.
  • With prefers-reduced-motion the rings are replaced by a steady thin ring; the animation also stops whenever the button is off-screen.
  • Pulses are slow fades (under one per second by default), well clear of photosensitivity limits.