Components

Scroll Reveal Text

A scroll-driven text reveal for React and Tailwind CSS: a paragraph whose words light up one by one as it scrolls through the viewport. Each word's opacity is a Motion value tied to scroll progress, so it never re-renders React, and the text stays real, selectable and SEO-friendly.

  • Scroll-linked
  • SEO-friendly real text
  • No re-renders
  • Scroll containers
  • prefers-reduced-motion

Scroll inside ↓

Good interfaces don't shout. They wait until you arrive, then reveal exactly what you need, one idea at a time, and get out of the way the moment you understand.

Installation

$ npx shadcn@latest add https://duskui.com/r/scroll-reveal-text.json

Usage

manifesto.tsx
import { ScrollRevealText } from "@/components/dusk/text/scroll-reveal-text"

export function Manifesto() {
  return (
    <ScrollRevealText className="text-3xl font-semibold">
      We build tools for people who do their best work after dark.
    </ScrollRevealText>
  )
}

Examples

Quote with custom timing

offset takes Motion useScroll offsets to control where the reveal starts and ends. baseOpacity sets how faint unread words are and wordClassName styles them. Inside a scroll container, pass its ref as container.

“We shipped the redesign on a Friday night. By Monday, nobody remembered the old one.”
— Someone who deploys on Fridays

API Reference

Also accepts any HTML attribute for the rendered element.

PropTypeDefaultDescription
childrenstring—The text to reveal. Plain text only; it is split into words.
as"p" | "div" | "blockquote" | "span" | "h1" … "h6""p"Element to render.
baseOpacitynumber0.18Opacity of words not reached yet (0–1).
offsetUseScrollOptions["offset"]["start 0.85", "end 0.5"]When the reveal starts and ends: starts when the top is 85% down the viewport, ends when the bottom reaches the middle.
containerRefObject<HTMLElement | null>—The scrolling element, when the text is inside a scroll container instead of the page.
wordClassNamestring—Classes for each word.

Accessibility

  • The words are the real text, split into inline spans with the original spacing, so there is no duplicated or hidden copy and selection, translation and search work normally.
  • The server, no-JS visitors and the first client render show the paragraph fully revealed; the reveal is armed just before the first paint.
  • Only opacity changes, and never below baseOpacity, so text is never fully invisible.
  • Scroll progress drives Motion values directly, with no React state per frame.
  • With prefers-reduced-motion every word is fully visible and scrolling changes nothing.