Text Appear
A heading whose words rise into place out of a blur, one after another.
$npx shadcn@latest add https://framebrick.co/r/text-appear.jsonFrom the Titen template, see it in context.
Build the thing people remember
import { TextAppear } from "@/components/ui/text-appear";
export default function TextAppearDemo() {
return (
<TextAppear
as="h2"
text="Build the thing people remember"
className="max-w-md text-center text-2xl font-semibold tracking-tight text-balance sm:text-3xl"
/>
);
}Examples
Letters
Each letter rises out of a blur, one after another; a word never breaks inside.
Hello, I am Alex
import { TextAppear } from "@/components/ui/text-appear";
export default function TextAppearLettersDemo() {
return <TextAppear as="h2" by="letter" text="Hello, I am Alex" className="text-3xl font-semibold tracking-tight sm:text-4xl" />;
}<TextAppear as="h2" by="letter" text="Hello, I am Alex" className="text-4xl font-semibold" />Whole text
The whole text rises as one block, for a lead or an intro.
A studio for brands that would rather be useful than loud.
import { TextAppear } from "@/components/ui/text-appear";
export default function TextAppearLinesDemo() {
return (
<TextAppear
by="line"
text="A studio for brands that would rather be useful than loud."
className="max-w-sm text-center text-base text-balance text-muted-foreground"
/>
);
}<TextAppear by="line" delay={0.4} text="A studio for brands that would rather be useful than loud." />Rows
Each wrapped line rises in turn, 0.05 s after the one before, with no blur: a page title that wraps.
Every page starts with a sentence that earns the next one
import { TextAppear } from "@/components/ui/text-appear";
/* Each wrapped line rises in turn (a page title). Which line a word is on is read from the layout, so it follows the width. */
export default function TextAppearRowsDemo() {
return (
<TextAppear
as="h2"
by="row"
delay={0.2}
text="Every page starts with a sentence that earns the next one"
className="max-w-xs text-center text-2xl font-semibold tracking-tight text-balance"
/>
);
}<TextAppear as="h1" by="row" delay={0.2} text="Every page starts with a sentence that earns the next one" className="max-w-xs text-2xl font-semibold text-balance" />Installation
$ npx shadcn@latest add https://framebrick.co/r/text-appear.json1. Install the dependencies.
npm install motion clsx tailwind-merge2. Add
cn()tolib/utils.ts(skip if shadcn already created it).import { clsx, type ClassValue } from "clsx"; import { extendTailwindMerge } from "tailwind-merge"; /* tailwind-merge must know the site's type scale (globals.css) is a font size, not a text color — otherwise cn("text-h6 text-muted-foreground") drops text-h6. */ const twMerge = extendTailwindMerge({ extend: { classGroups: { "font-size": [{ text: ["display", "h1", "h2", "h3", "h4", "h5", "h6"] }] } }, }); export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); }3. Copy the component into
components/ui/text-appear.tsx."use client"; import * as React from "react"; import { motion, type Transition } from "motion/react"; /* * Text Appear — a heading whose words rise into place out of a blur, one after another (from the Titen headings; * Ciketo has the same effect without the blur, which `blur={0}` gives; Tustel's hero does it letter by letter, which * `by="letter"` gives). * It plays once: on load, or the first time it scrolls into view. * * Framer's springs are overdamped — no overshoot, settled in well under a second: * words: from opacity 0, y 10, blur 7px, spring 320 / 58 / 1, each word 0.05s after the one before; * lines: from y 7, spring 320 / 64 / 1 — `by="line"` moves the whole text at once; * letters (Tustel): from y 10, blur 10px, spring bounce 0 over 0.3s, each letter 0.05s after the one before; a word * never breaks inside and the spaces do not move. * Letters are their own boxes, so the kerning inside a word is lost, as in Framer: keep `by="letter"` for short * display text and use whole words for anything long. * * Rows (Framer's IntroLines under the title of an inner page — Ciketo, Catchup): each wrapped line rises 7px and fades * in, no blur, 0.05s after the line before, from a start delay (Catchup 0.2s). The markup is the word mode's, so the * HTML never depends on where the text wraps (that would be a hydration mismatch). Once the browser has laid it out, * each word's offsetTop — which ignores transforms, so the hidden words measure like the shown ones — says which row * it is on, and that only sets the word's delay. The words wait, hidden, until that is known (before the first paint), * and it is measured again when the width changes. * * Reduced motion: <MotionConfig reducedMotion="user"> skips the movement but would keep animating opacity and blur, * so this checks for it itself (see usePrefersReducedMotion below) and shows the text at once. * Screen readers get the sentence once, from an sr-only copy; the animated words are aria-hidden. * The words start at opacity 0 on the server, so the text appears when the page hydrates — keep `delay` short. */ const word: Transition = { type: "spring", stiffness: 320, damping: 58, mass: 1 }; const line: Transition = { type: "spring", stiffness: 320, damping: 64, mass: 1 }; const letter: Transition = { type: "spring", bounce: 0, duration: 0.3 }; export type TextAppearProps = { /** The text. It is split on spaces, so the kerning inside a word is never touched (unless `by="letter"`). */ text: string; /** The element to render: a heading, a paragraph, anything. */ as?: React.ElementType; /** "word" moves each word in turn; "row" each wrapped line; "letter" each letter; "line" moves the whole text at once. */ by?: "word" | "row" | "line" | "letter"; /** "load" plays as soon as it mounts; "view" waits until it scrolls into view. Either way, once. */ trigger?: "load" | "view"; /** Seconds before it starts. */ delay?: number; /** Seconds between words (between rows with `by="row"`, between letters with `by="letter"`). */ stagger?: number; /** Blur it starts from, in px; 0 turns the blur off (Ciketo). 7 for words, 10 for letters, none for rows. */ blur?: number; /** How far it rises, in px: 10 by word and by letter, 7 by line and by row. */ distance?: number; className?: string; }; /* * Whether the visitor asked for reduced motion — read the way React expects for anything that changes the markup. * useReducedMotion() reads matchMedia during the first client render, but the server cannot, so it sends the animated * words while a reduced-motion client renders plain text: a hydration error, and React rebuilds the whole tree. * useSyncExternalStore with a server snapshot of false renders what the server sent first, then switches to the real * answer without an error. */ function usePrefersReducedMotion() { return React.useSyncExternalStore( (onChange) => { const query = window.matchMedia("(prefers-reduced-motion: reduce)"); query.addEventListener("change", onChange); return () => query.removeEventListener("change", onChange); }, () => window.matchMedia("(prefers-reduced-motion: reduce)").matches, () => false, ); } export function TextAppear({ text, as: Tag = "p", by = "word", trigger = "load", delay = 0, stagger = 0.05, blur, distance, className, }: TextAppearProps) { const reduce = usePrefersReducedMotion(); const words = React.useMemo(() => text.split(" "), [text]); const rise = distance ?? (by === "line" || by === "row" ? 7 : 10); const blurred = blur ?? (by === "letter" ? 10 : by === "row" ? 0 : 7); /* Rows: the row each word is on, null until the text has been laid out. */ const container = React.useRef<HTMLSpanElement>(null); const [rows, setRows] = React.useState<number[] | null>(null); const byRow = by === "row"; React.useLayoutEffect(() => { const element = container.current; if (!byRow || reduce || !element) return; const measure = () => { let row = -1; let top = -Infinity; const next = Array.from(element.querySelectorAll<HTMLElement>("[data-appear-word]"), (item) => { if (item.offsetTop > top + 2) { row += 1; top = item.offsetTop; } return row; }); setRows((previous) => (previous && previous.length === next.length && previous.every((value, index) => value === next[index]) ? previous : next)); }; measure(); const observer = new ResizeObserver(measure); observer.observe(element); return () => observer.disconnect(); }, [byRow, reduce, text]); if (reduce) { return <Tag className={className}>{text}</Tag>; } const hidden = { opacity: 0, y: rise, filter: blurred ? `blur(${blurred}px)` : "blur(0px)" }; const shown = { opacity: 1, y: 0, filter: "blur(0px)" }; /* A row's delay is read from the layout, so a load waits (hidden) until the rows are known; a view is asked for only once it is on screen, which is after the layout effect has run. */ const inView = trigger === "view" ? { whileInView: "shown", viewport: { once: true, amount: 0.3 } } : { animate: byRow && !rows ? "hidden" : "shown" }; const orchestration = byRow ? {} : { delayChildren: delay, staggerChildren: by === "line" ? 0 : stagger }; /* The element stays whatever `as` says; the orchestration sits on a span inside it, so no component is built during render (and the heading keeps its own styles). */ return ( <Tag className={className} data-text-appear=""> {/* * The words render at opacity 0 on the server, so without JavaScript the heading would never appear — a blank * hero on a broken bundle. This puts them back for that case; with JavaScript it never applies. */} <noscript> <style>{`[data-text-appear] [data-appear-word]{opacity:1!important;filter:none!important;transform:none!important}`}</style> </noscript> {/* The sentence, read once. */} <span className="sr-only">{text}</span> <motion.span ref={container} aria-hidden initial="hidden" {...inView} variants={{ shown: { transition: orchestration } }} className="inline-block" > {by === "line" ? ( <motion.span data-appear-word variants={{ hidden, shown }} transition={line} className="inline-block"> {text} </motion.span> ) : by === "letter" ? ( words.map((part, index) => ( <React.Fragment key={`${part}-${index}`}> {/* A word never breaks inside, and the spaces between words stay still. */} <span className="inline-block whitespace-nowrap"> {[...part].map((char, position) => ( <motion.span key={position} data-appear-word variants={{ hidden, shown }} transition={letter} className="inline-block"> {char} </motion.span> ))} </span> {index < words.length - 1 && " "} </React.Fragment> )) ) : ( words.map((part, index) => ( <React.Fragment key={`${part}-${index}`}> <motion.span data-appear-word variants={{ hidden, shown }} transition={byRow ? { ...line, delay: delay + stagger * (rows?.[index] ?? 0) } : word} className="inline-block" > {part} </motion.span> {index < words.length - 1 && " "} </React.Fragment> )) )} </motion.span> </Tag> ); }
Usage
import { TextAppear } from "@/components/ui/text-appear";
<TextAppear as="h1" text="Build the thing people remember" className="text-4xl font-semibold" />
<TextAppear by="line" delay={0.4} text="A studio for brands that would rather be useful than loud." />
// Ciketo's version: no blur, a touch slower between words
<TextAppear text="Design that earns its keep" blur={0} stagger={0.075} trigger="view" />
// Tustel's hero: letter by letter
<TextAppear by="letter" text="Hello, I am Alex" />
// Catchup's page titles: each wrapped row in turn, no blur
<TextAppear as="h1" by="row" delay={0.2} text="A page title that wraps over a few lines" />Props
| Prop | Type | Default | Description |
|---|---|---|---|
| text | string | — | The text. It is split on spaces, so the kerning inside a word is never touched (unless `by="letter"`). |
| as | ElementType | "p" | The element to render: a heading, a paragraph, anything. |
| by | "word" | "row" | "line" | "letter" | "word" | Move each word in turn, each wrapped row in turn, each letter, or the whole text at once. |
| trigger | "load" | "view" | "load" | Play on mount, or the first time it scrolls into view. Either way, once. |
| delay | number | 0 | Seconds before it starts. |
| stagger | number | 0.05 | Seconds between words (between rows with `by="row"`, between letters with `by="letter"`). |
| blur | number | 7 / 10 / 0 | Blur it starts from, in px; 0 turns the blur off. 7 by word and by line, 10 by letter, none by row. |
| distance | number | 10 / 7 | How far it rises, in px (10 by word and by letter, 7 by line and by row). |
- Screen readers get the sentence once, from a visually hidden copy; the animated words are aria-hidden.
- With reduced motion the text is simply there: MotionConfig would skip the movement but keep animating opacity and blur, so the component checks for itself. The server cannot know, so it sends the animated words and a reduced-motion visitor gets plain text right after hydration — chosen with useSyncExternalStore, because reading matchMedia in the first client render is a hydration mismatch.
- The words start at opacity 0 on the server, so the text appears when the page hydrates — keep the delay short on anything above the fold. A noscript style puts them back if JavaScript never runs, so the heading is never simply missing.
- For tests: with JavaScript on, the element's textContent holds the sentence twice (the screen-reader copy and the animated words) plus the text of the noscript style, so an assertion on textContent sees more than the sentence. Query the heading by role and name instead — it reads once to assistive technology — or check that it is visible.
- Whole words keep their kerning; `by="letter"` is Tustel's hero, and splits the text into letters as Framer does, so the kerning inside a word is lost. Keep it for short display text. A word never breaks inside and the spaces between words do not move; each letter rises 10 px out of a 10 px blur on a spring with no bounce over 0.3 s, 0.05 s after the one before. `by="line"` moves the lot.
- `by="row"` is the page-title effect of Ciketo and Catchup: each wrapped line rises 7 px and fades in, 0.05 s after the line before, from the start `delay` (Catchup 0.2 s), with no blur. Ciketo's slower 0.075 s is `stagger`. The markup is the word mode's, so the HTML never depends on where the text wraps (that would be a hydration mismatch): once the browser has laid the words out, each word's offsetTop says which row it is on, and that only sets its delay. A load waits, hidden, until the rows are known (before the first paint), and they are measured again when the width changes.
AI prompt
Paste into v0, Lovable, Bolt or Claude to rebuild this component in your own project.
Create a React + Tailwind CSS + Motion (motion/react) component called TextAppear.
- Split the text on spaces into inline-block spans, keeping the spaces as text between them so it still wraps.
- Each word animates from opacity 0, y 10 and blur 7px to rest, with a spring of stiffness 320, damping 58, mass 1,
each word 0.05s after the one before (delayChildren for the initial delay, staggerChildren for the rest).
- by="line" moves the whole text as one span instead, from y 7, spring 320 / 64 / 1.
- by="letter" wraps each word in an inline-block whitespace-nowrap span (a word never breaks inside; the spaces stay
outside, still) and animates every letter from opacity 0, y 10 and blur 10px, with a spring of bounce 0 and duration 0.3s,
each letter 0.05s after the one before (the stagger runs across all letters in order). Give each letter data-appear-word
so the noscript style restores it.
- by="row" renders the same word spans (the markup must not depend on where the text wraps). After layout, in a
useLayoutEffect with a ResizeObserver on the container, read each word's offsetTop (it ignores transforms, so the
hidden words measure like the shown ones): a new row starts when offsetTop grows by more than 2px. Keep the row of
every word in state, null until measured, and only set the state when the rows changed. A word rises from opacity 0
and y 7, no blur, on the line spring (stiffness 320, damping 64, mass 1), with transition delay = delay + stagger * its row; the
parent has no delayChildren or staggerChildren. With trigger="load" keep animate="hidden" until the rows are known.
- trigger="load" animates on mount; trigger="view" uses whileInView with { once: true, amount: 0.3 }.
- Put the orchestration on a span inside the element the caller asked for, so no component is created during render.
- A visually hidden copy of the text carries it for screen readers; the animated spans are aria-hidden.
- With useReducedMotion() true, render the plain text — MotionConfig would still animate opacity and blur.










