A heading revealed by drops of ink landing across it and spreading until they meet, with a soft halo at the wet edges.
A headline folded like paper that opens out as it scrolls into view: each line swings down from its crease, concertina-style, with a shadow that lifts as it flattens.
Customize
Usage
import { FoldReveal } from "@/components/motionkit/fold-reveal";
<FoldReveal
as="h1"
lines={["Ideas that", "unfold beautifully"]}
className="font-display text-7xl"
/>Motion
The exact curves this component runs, plotted with Motion's own maths.
Lines unfold
Scrolls into view
Editorial and portfolio headlines, launch pages, section titles and print-inspired brands.
Each line sits in its own perspective box and starts rotated about 90 degrees on its X axis, hinged at the top or the bottom in turn, so the stack reads like a concertina. When it scrolls into view the lines swing flat one after another with a slightly overshooting ease, and a gradient shadow over each line fades as it opens, as light would on a real crease.
Works in the App Router as is. Requires Tailwind CSS v4.
One command adds the file and installs its dependencies. Needs a components.json (run npx shadcn@latest init once if you don't have one).
npx shadcn@latest add https://www.motionkitui.com/r/fold-reveal.jsonnpm install motionSave as components/motionkit/fold-reveal.tsx.
"use client";
import type { ElementType } from "react";
import { motion, useReducedMotion } from "motion/react";
type FoldRevealProps = {
/** The text; each line folds out on its own. Pass an array, or separate lines with \n. */
lines: string[] | string;
/** The element to render, e.g. "h1". */
as?: ElementType;
/** Seconds for each line to unfold. */
duration?: number;
/** Seconds between one line and the next. */
stagger?: number;
/** Unfold every time it scrolls into view, not just the first. */
repeat?: boolean;
className?: string;
};
/**
* A headline folded like a sheet of paper that opens out as it scrolls into view: each line swings down from a
* crease, alternating direction like a concertina, with a shadow in the fold that lifts as it flattens.
*/
export function FoldReveal({ lines, as: Tag = "h2", duration = 0.9, stagger = 0.12, repeat = false, className = "" }: FoldRevealProps) {
const reduceMotion = useReducedMotion();
const rows = Array.isArray(lines) ? lines : lines.split("\n");
return (
<Tag className={className}>
<motion.span className="block" initial="folded" whileInView="open" viewport={{ once: !repeat, amount: 0.5 }} transition={{ staggerChildren: stagger }}>
{rows.map((row, index) => {
// alternate creases, top then bottom, as a concertina folds
const fromTop = index % 2 === 0;
return (
<span key={index} className="block [perspective:900px]">
<motion.span
className="relative block"
style={{ transformOrigin: fromTop ? "50% 0%" : "50% 100%", transformStyle: "preserve-3d" }}
variants={{
folded: reduceMotion ? { opacity: 0 } : { opacity: 0, rotateX: fromTop ? -92 : 92, y: fromTop ? -6 : 6 },
open: { opacity: 1, rotateX: 0, y: 0 },
}}
transition={{ duration: reduceMotion ? 0.3 : duration, ease: [0.22, 1.2, 0.36, 1] }}
>
{row}
{/* the shadow in the crease, lifting as the line flattens */}
<motion.span
aria-hidden
className="pointer-events-none absolute inset-0"
style={{ background: `linear-gradient(${fromTop ? 180 : 0}deg, rgb(0 0 0 / 0.65), transparent 85%)` }}
variants={{ folded: { opacity: reduceMotion ? 0 : 1 }, open: { opacity: 0 } }}
transition={{ duration: reduceMotion ? 0 : duration * 0.9, ease: "easeOut" }}
/>
</motion.span>
</span>
);
})}
</motion.span>
</Tag>
);
}
| Prop | Type | Default | Description |
|---|---|---|---|
| lines | string[] | string | — | The lines; pass an array or separate them with \n. |
| duration | number | 0.9 | Seconds for each line to unfold. |
| stagger | number | 0.12 | Seconds between lines. |
| repeat | boolean | false | Unfold every time it scrolls into view. |
| as | ElementType | "h2" | Element to render, e.g. h1. |
How we audit: the WCAG 2.2 animation checklist and respecting reduced motion in React.
Yes. The file starts with "use client", so you can import it straight into a Server Component page or layout. It works in Vite as is, and in Astro as a React island.
Only the motion package, beside React and Tailwind CSS v4. There is no MotionKit package and no Tailwind config to add.
Yes. Run npx shadcn@latest add https://www.motionkitui.com/r/fold-reveal.json in any project with a components.json. It saves the file to components/motionkit and installs its dependencies.
With reduced motion on, the lines fade in without folding.
A heading revealed by drops of ink landing across it and spreading until they meet, with a soft halo at the wet edges.
A headline cut into bands like a sliced print: hover and the bands slide apart in alternate directions, revealing the word in a second colour through the cut.
A headline that resolves like an image loading: it arrives as a few big blocks of colour, and each step halves the pixels until the letters snap sharp.
Ideas thatunfold beautifully