affectUI › Motion › Text

Text Reveal

Text that arrives word by word or letter by letter – each piece rises out of a soft blur as it scrolls into view.

Free and open source (MIT). Install: npx shadcn@latest add https://www.affectui.com/r/text-reveal.json · Import from @/components/ui/text-reveal

When to use

  • Headlines and short intros on landing pages that should arrive as you scroll
  • A key sentence you want read in order, like a mission statement or a quote

When not to use

  • Long paragraphs or anything people need to read right away – waiting for words gets tiring
  • Text that changes often, like live data – the reveal plays only when it enters the view

Usage

import { TextReveal } from "@/components/ui/text-reveal";

export function Intro() {
  return <TextReveal as="h2" text="Words that arrive one at a time." />;
}

Props

NameTypeDefaultDescription
textstringThe text to reveal
by"word" | "char""word"Reveal word by word or letter by letter
staggernumber40Time between two pieces, in ms
delaynumber0Wait before the first piece, in ms
durationnumber700Time each piece takes to arrive, in ms
as"p" | "h1" | "h2" | "h3" | "span""p"Element to render
oncebooleantrueReveal only the first time; otherwise it plays again each time it enters the view
classNamestringExtra class on the root

Accessibility

  • Screen readers get the full sentence from a visually hidden copy; the animated pieces are aria-hidden
  • Words never break in the middle, and spaces stay real, so lines wrap like normal text

Responsive

  • Font, size and color come from the parent, so it fits any heading or paragraph
  • Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"

Requirements

  • React 19

Related

  • Gradient Text – Letters cut from a liquid, ever-flowing gradient – the color sweeps across the word the first time it's seen

Guides