cnippet/ui
  1. motion
  2. text animations
  3. random letter swap

text animations

Random Letter Swap

Letters swap in a randomised order on hover — each letter slides out and a copy slides in, but the sequence is shuffled for a glitchy, unpredictable feel.

Installation

Usage

Anatomy

Good to know

  • The text goes in the label prop, not in children.
  • The effect plays on hover, so there's nothing to see on touch screens.
  • Screen readers get the text through aria-label; the animated letters are hidden from them.
  • Use LetterSwapHover for the same effect in a fixed order.
  • When the user has turned on reduced motion, hovering does nothing and the text stays still.

Props

Examples

Each link shuffles independently on hover. The random order makes each nav item feel distinct even though they share the same component.

CTA Buttons

Two call-to-action buttons with reverse={false} on the primary so the letters slide up instead of down, creating visual contrast.

Tag Chips

Technology tags inside pill badges shuffle on hover. Short words with fast staggerDuration produce a rapid glitch pop.