Skip to content

Scroll Text Reveal for React

TextReveal is a React effect that lights up the words of a statement one by one as you scroll. The text stays real, readable without JavaScript, never shifts layout and is fully visible under reduced motion.

npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/text-reveal.json

We build interfaces that feel like light passing through glass: calm, precise and never in the way.

Scroll to read.

Scroll inside the panel

Pass container to follow a scrollable panel instead of the page. offset sets where the reveal starts and ends; here it begins as the text enters the panel and finishes at the middle. Scroll back and the words dim again.

We build interfaces that feel like light passing through glass: calm, precise and never in the way of the thing you came to do.

Files to copy

4 folders · 4 files · 3 packages
From theme/src/
  • components/text-reveal/
  • hooks/{use-media-query.ts, use-preferences.ts}
  • lib/{canvas-effects.ts, cn.ts}
  • styles/
shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/text-reveal.jsonRegistry item: text-reveal. The styles need the Tailwind v4 glass UI setup.
Packages
pnpm add clsx motion tailwind-merge

On the page, as a paragraph

Without container it follows the page scroll. Raise dim towards 1 for a subtler reveal; keep it at 0.25 or above so unread words stay legible.

Each word arrives as you reach it, left to right, like a progress bar made of language.

Props

PropTypeDefaultDescription
children (required)stringNoneThe text to reveal, as one plain string. Words are split on whitespace.
asTextRevealTag"p"The element to render: a paragraph for running text, a heading for a statement.
dimnumber0.28How dim a word is before the scroll reaches it, from 0 (invisible) to 1 (no effect). Keep it at 0.25 or above so the unread words stay legible.
offsetScrollOffset["start 0.9", "end 0.5"]Which part of the scroll drives the reveal, in Motion's offset format: ["start 0.9", "end 0.5"] starts when the top of the text reaches 90 % of the viewport height and finishes when its bottom reaches the middle.
containerRefObject<HTMLElement | null>the pageThe scrollable element that drives the reveal.

Keyboard

KeysAction
TabNot focusable: the text is plain content in the normal reading order.

Accessibility

  • The words are real text with normal spaces, in order: selectable, searchable and read by screen readers whatever their opacity. Before hydration (or without JavaScript) every word is fully visible.
  • Dimmed words are lower contrast until revealed: keep dim at 0.25 or above, and avoid the effect on text that must be read at once (instructions, legal copy).
  • Use as="h2" only for a heading that belongs in the outline.
  • Only opacity changes, driven by the scroll position through MotionValues: no layout shift, no React renders while scrolling, no loop to pause. Reduced motion shows every word at full opacity.

When to use the text reveal effect

  • Use it for a manifesto, mission line or long hero statement where the scroll sets the pace of reading.
  • Use as="h2" for a heading statement, or leave it a paragraph; tune offset to start and finish the reveal where you want.
  • Keep dim at 0.25 or above so unrevealed words stay legible.
  • Skip it for instructions, legal copy or anything that must be read at once.
  • Pair it with ScrollProgress for a reading cue and a calm background.

Frequently asked questions

19 effects pages in all: browse them on All effects.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .