Command Palette
Search for a command to run

Random Letter Swap

A text component that randomly swaps the letters vertically on hover.

motion-sv
Random Letter Swap Bottom To Top Animation Ping Pong Animation Comes From The Bottom

There are two types of animations available for this component:

  1. Forward animation — plays the animation timeline once forward
  2. Ping Pong animation — plays the animation timeline in a ping pong fashion.

Installation

Forward Animation

pnpm dlx shadcn-svelte@latest add http://sveltekit-prerender/f/random-letter-swap.json

Ping Pong Animation

pnpm dlx shadcn-svelte@latest add http://sveltekit-prerender/f/random-letter-swap-ping-pong.json
Visit Original Docs

For more deeper understaing visit fancy components documentation.

Props

Shared Props

These props apply to both the forward and ping-pong Random Letter Swap variants shown on this page.

NameTypeDefaultDescription
label
string required Text string split into characters and shuffled into a random reveal order.
reverse
boolean true Reverses the vertical swap direction for the entering characters.
transition
AnimationOptions { type: "spring", duration: 0.8 } Motion options used for each randomly ordered character swap.
staggerDuration
number 0.02 Delay in seconds between characters in the shuffled animation order.
class
string undefined Classes merged onto the interactive text wrapper.