Letter Swap

A text animation that swaps the letters vertically on hover.

Loading...

Installation

pnpm dlx shadcn@latest add https://atlasui.dev/r/letter-swap.json

Usage

import { LetterSwap } from "@/components/letter-swap";
<LetterSwap text="Hello World" />
 
<LetterSwap text="Atlas UI" />

Props / Data Attributes

PropTypeDefaultRequiredDescription
textstring-trueThe text content to animate
reversebooleanfalsefalseControls the direction of the animation. (false: bottom to top, true: top to bottom)
staggerDurationnumber0.02falseDelay between each letter animation
staggerFromfirst | last | centerfirstfalseDirection from where the animation starts
classNamestring0falseOptional classnames for according to match your setup