text animations
Letter 3D Swap
Each letter rotates in 3D space on hover — the front face spins away and a second face takes its place. Supports four rotation axes and independent colour per face.
Installation
Usage
Anatomy
Good to know
- The effect plays on hover, so there's nothing to see on touch screens.
childrenshould be plain text. It's split into letters.- Style the two faces separately with
frontFaceClassNameandsecondFaceClassName. rotateDirectionis"top","bottom","left"or"right".- Screen readers read the full text once; the letter cubes are hidden from them.
- When the user has turned on reduced motion, hovering does nothing and the text stays still.
Props
Examples
Navigation Links
Nav links rotate upward on hover (rotateDirection="top"). Front face uses text-muted-foreground, second face reveals text-foreground — a colour-change through 3D space.
CTA Buttons
Two buttons — filled and outlined — with opposite rotateDirection values and staggerFrom="last" on the secondary to reverse the wave.
Direction Showcase
Four rows of the same word, each with a different rotateDirection. Hover to compare top, right, bottom, and left rotations side by side.