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.jsonWe 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.
import { useRef } from "react";
import { TextReveal } from "@/components/sheenui/text-reveal/text-reveal";
// Package build (after the first npm release, or a packed tarball): import { TextReveal } from "@sheenui/theme";
export function Example() {
const scroller = useRef<HTMLDivElement>(null);
return (
<div ref={scroller} role="region" aria-label="Manifesto" tabIndex={0} className="h-96 w-full overflow-y-auto p-8 focus-visible:outline-2 focus-visible:outline-sheen-focus">
<div className="h-40" />
<TextReveal
as="h2"
container={scroller}
offset={["start 0.9", "end 0.5"]}
className="text-3xl font-semibold tracking-tight text-balance"
>
We build interfaces that feel like light passing through glass: calm, precise and never in the way of the thing you came to do.
</TextReveal>
<div className="h-96" />
</div>
);
}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.
import { TextReveal } from "@/components/sheenui/text-reveal/text-reveal";
// Package build (after the first npm release, or a packed tarball): import { TextReveal } from "@sheenui/theme";
export function Example() {
return (
<TextReveal dim={0.4} className="max-w-xl text-lg text-pretty">
Each word arrives as you reach it, left to right, like a progress bar made of language.
</TextReveal>
);
}Props
Keyboard
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
Related pages
19 effects pages in all: browse them on All effects.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .