Text Flip

A 3D character flip on hover, staggered and springy across every single letter.

textflip3dheadlineanimationtypographyhover
Text Flip component preview

Overview

Text Flip is a React and Tailwind CSS 3D flip text animation where every letter turns like a cube face on hover, click, or both, in Next.js or any React app, with no dependencies. The Web Animations API drives a springy flip per character, staggered from the first, last, center, or a random letter, around either axis. Emoji and accented letters stay whole because text is split by grapheme, and screen readers hear the full string once. Call flip() through a ref or change replayKey to run it from code, and reduced motion leaves the text still.

Installation

Run the following command

~/your-project
pnpm dlx wensity@latest add text-flip

Usage

Import TextFlip from @/components/wensity/text-flip and render it anywhere in your React or Next.js app. The source lands in your own repo, so every prop, class and animation below is yours to edit.

app/example.tsx
import { TextFlip } from "@/components/wensity/text-flip";
export default function Example() {
return (
<TextFlip
as="h1"
text="Wensity UI"
direction="top"
trigger="hover"
className="font-display text-xl font-normal"
/>
);
}

Props

PropTypeDefaultDescription
textstring-The string to render.
askeyof React.JSX.IntrinsicElements"span"Tag rendered as the outer element.
direction"top" | "right" | "bottom" | "left""top"Axis the characters rotate around when flipping.
trigger"hover" | "click" | "both""hover"What starts a flip cycle.
durationnumber0.45Flip duration per character in seconds.
staggerDurationnumber0.05Delay between each character, in seconds.
staggerFrom"first" | "last" | "center" | "random" | number"first"Where the stagger wave originates.
easingstringcubic-bezier(0.34, 1.4, 0.64, 1)CSS easing. Default approximates a spring overshoot.
frontColorstringthemeFront face color. Omit for theme auto.
backColorstringthemeBack face color. Omit for theme auto.
disabledbooleanfalseDisable pointer triggers. Imperative flip() still works.
replayKeystring | number-Changing this value forces a flip cycle.

Featured in React hero section components.