text animations
Letter Swap Hover
Each letter slides out vertically on hover while an identical copy slides in behind it — creating a smooth looping swap effect driven entirely by cursor entry.
Installation
Usage
Anatomy
Good to know
- The text goes in the
labelprop, not inchildren. - The effect plays on hover, so there's nothing to see on touch screens.
reverse(defaulttrue) sets the roll direction.staggerFromsets which letter starts.- Screen readers get the text through
aria-label; the animated letters are hidden from them. - When the user has turned on reduced motion, hovering does nothing and the text stays still.
Props
Examples
Navigation Links
Each nav link swaps independently on hover. The stagger makes the motion feel distinct per item even when items sit close together.
CTA Buttons
Two buttons — filled and outlined — both using LetterSwapHover. reverse={false} on the primary flips the direction for visual contrast.
Stats Row
Labels beneath stat figures use staggerFrom="center" so letters fan outward from the middle — a subtle touch that differentiates them from standard hover states.