Text Animations

Reflow

Text whose words keep their identity when the line breaks move — narrow the measure and the sentence travels instead of re-wrapping.

Install

bun add motion clsx tailwind-merge

Then copy 2 files into your project:

  • components/registry/reflow/reflow.tsx
  • lib/utils.ts

Props

PropTypeDefaultDescription
columnWidthnumber100Width of the text column as a percentage of its container — the measure. Dragging this is the reflow, with not one word changing.
stiffnessnumber340Spring tension on the travel.
dampingnumber34Spring friction on the travel.
staggernumber14Delay between one word starting its travel and the next. The index is capped at twenty, so a long paragraph cannot leave its tail sitting still in plain sight.
enterScalenumber0.82Size a word enters at and leaves at.
wordGapnumber0.3Space between words. A margin rather than a space character, so a word leaving the sentence does not strand the gap that followed it.
lineHeightnumber1.6Leading.
align"left" | "center" | "right""left"Text alignment.
autobooleantrueAdvance through the phrases on a timer.
intervalnumber3600Time on each phrase.
traceMovesbooleanfalseTint a word for as long as it is travelling. A debugging affordance that earned its place — it is the only way to prove a word moved rather than being destroyed and re-created somewhere else.
accentColorstring (hex)"#a855f7"The trace tint.

What It Demonstrates

Layout animation
When an element's size or position changes, it animates to the new spot instead of snapping.
Continuity transition
A change that keeps the user oriented by visually connecting before and after. For example, making the same rectangle bigger and smaller.
Spatial consistency
Animating so an element keeps its identity and position across states, so users never lose track of where things went.
Enter / Exit
The animation an element plays when it's added to or removed from the screen.
Stagger
Animate several items one after another with a small delay between each, creating a cascade.

Related Components

Appears In