Wave text

Letters ride a springy travelling wave on hover or in view, with wave, bounce, and scatter variants.

pnpm dlx shadcn@latest add @uiarc/wave-text
Live · keyboard ready

Ride the wave

  • Section titles and hero headlines that should feel alive on hover.
  • Celebration moments: fire play() after a success.
  • Logos and wordmarks on playful landing pages.
  • Body copy or long headings; the motion becomes noise.
  • Use text-shimmer to signal ongoing work.
  • Use rubber-band-text when the letters should be grabbable.

Installation

Add Wave text with the shadcn CLI, or copy the source by hand.

pnpm dlx shadcn@latest add @uiarc/wave-text

Adds the component and its local dependencies, and installs motion. First time? Add the @uiarc registry to components.json, or use the full URL:

example.tsx
import { WaveText } from "@/components/arc/wave-text/wave-text"; export function Title() {  return <WaveText as="h2" text="Ride the wave" variant="bounce" />;}

WaveText

Text whose letters ride a travelling wave. Hovering sends a ripple out from the letter under the pointer and a sweep runs when the text scrolls into view. Every letter is its own spring, so motion overlaps and follows through.

PropTypeDefaultDescription
textRequiredstring–The text. Words wrap as whole words.
as"h1" | "h2" | "h3" | "h4" | "p" | "span" | "div""span"Element to render.
variant"wave" | "bounce" | "scatter""wave"wave rises and settles, bounce hops and lands with a squash, scatter knocks letters loose and pulls them home.
trigger"hover" | "in-view" | "both" | "manual""both"What starts the motion. manual only runs play() from the ref.
amplitudenumber0.4Peak lift as a fraction of the font size.
staggernumber0.032Seconds between neighbouring letters.
colorstringvar(--accent)Color a letter takes at the top of its travel, fading back as it settles. Pass "currentColor" to keep one color.
refRef<{ play: (from?: number) => void }>–Imperative handle. play(from) sends a wave outward from a letter index.
classNamestring–Extra class on the root.
styleCSSProperties–Inline styles on the root.
  • Screen readers get the text once from a visually hidden copy; the animated letters are aria-hidden, so words are never spelled out letter by letter.
  • It is not interactive and adds no tab stops; hover only adds motion.
  • Reduced motion disables every sweep and ripple.
  • Each letter is a spring (wave, scatter) or a small gravity body with a bouncy floor (bounce), integrated in one rAF loop.
  • Kicks are scheduled per letter with a stagger, so the wave visibly travels.
  • Entering the text ripples the whole line from the entry letter; moving along it pushes a short swell that follows the pointer.
  • Kicks set velocity rather than add to it, so lingering never pumps letters higher.
  • Wave letters tilt in the direction of travel; bounce letters stretch in flight and squash on landing.
  • Offsets are in em, so the motion scales with the font size.
  • Touch drags along the text trigger the same ripple as hover.
  • Words wrap as whole words at narrow widths.
  • The loop runs only while letters move and writes one transform per letter.
  • The in-view sweep uses one IntersectionObserver that disconnects after the first run.

Notes for AI

Give your coding assistant the Markdown reference instead of screenshots.

  • Use it on headings and short labels; keep it under about 40 letters.
  • Use trigger="manual" with the ref to fire a wave on an event, such as a successful submit.
  • bounce is the most playful; wave suits calm brands; scatter works for a single word.
/components/wave-text/markdown

The full library index for assistants is at /llms.txt.