Letter 3d Swap

3D box letter swap animation on hover with configurable rotation direction and stagger

Installation

pnpm dlx shadcn@latest add "https://vritti.thesatyajit.com/r/letter-3d-swap"

Dependencies

pnpm add motion

Props

Letter 3d Swap

PropTypeDefaultDescription
childrenReact.ReactNode-Text content to animate
asElementType"p"HTML element type to render as
mainClassNamestring-CSS classes for the main container element
frontFaceClassNamestring-CSS classes for the front face of each letter
secondFaceClassNamestring-CSS classes for the second (reveal) face of each letter
staggerDurationnumber0.05Delay between each letter's animation in seconds
staggerFrom"first" | "last" | "center" | number | "random""first"Direction from which the stagger effect originates
transitionValueAnimationTransition | AnimationOptions{ type: "spring", damping: 30, stiffness: 300 }Motion transition configuration for the swap animation
rotateDirection"top" | "right" | "bottom" | "left""right"Direction of the 3D rotation on hover