GooseUI

Components

Scroll Word Reveal

New

A paragraph whose words come out of a blur one after another while the page scrolls. It is a server component with no JavaScript: every word runs the same CSS keyframes on the paragraph's view() timeline, and its own animation-range is shifted by its index. Screen readers get the whole text at once, and with reduced motion the text is simply visible.

Browser Support

Scroll-driven animations

Reveals words while scrolling.

Your browser:

Preview

The demo scrolls inside its own box: a view() timeline follows the nearest scroll container on its own.

Scroll inside this box ↓

Good interfaces explain themselves. We study how people work, sketch the flow, build it carefully and keep polishing after launch.

Installation

npx shadcn@latest add @gooseui/scroll-word-reveal
pnpm dlx shadcn@latest add @gooseui/scroll-word-reveal
yarn dlx shadcn@latest add @gooseui/scroll-word-reveal
bunx --bun shadcn@latest add @gooseui/scroll-word-reveal

Usage

import { ScrollWordReveal } from "@/components/ui/scroll-word-reveal"

export default function Statement() {
  return (
    <section className="py-24">
      <ScrollWordReveal
        className="text-4xl font-semibold tracking-tight"
        text="Good interfaces explain themselves. We study how people work and keep polishing after launch."
      />
    </section>
  )
}

Examples

Softer reveal

Less blur and a higher starting opacity keep the text readable even before it is revealed.

Scroll inside this box ↓

Good interfaces explain themselves. We study how people work, sketch the flow, build it carefully and keep polishing after launch.

<ScrollWordReveal text={text} blur={2} initialOpacity={0.35} />

Heavy blur, short range

A larger wordSpan makes neighbouring words appear together, a heavy blur makes the effect obvious.

Scroll inside this box ↓

Every word waits for its turn.

<ScrollWordReveal
  text="Every word waits for its turn."
  blur={14}
  initialOpacity={0}
  wordSpan={0.4}
  className="text-4xl font-bold"
/>

Inside a scrollable container

Nothing to pass: view() tracks the nearest scrolling ancestor, so the same component works in a panel, a modal or a docs preview. The offset lines are measured in that container's height.

<div className="h-96 overflow-y-auto">
  <div className="h-80" />
  <ScrollWordReveal text={text} offset={[1, 0.3]} />
  <div className="h-96" />
</div>

Props

PropTypeDefaultDescription
textstring-Paragraph text, split into words by whitespace
asElementType"p"Element to render
offset[number, number][0.9, 0.25]Two lines as a share of the scroll container height from the top: the reveal starts when the top of the text crosses the first and ends when its bottom crosses the second
blurnumber6Blur of a hidden word, in px
initialOpacitynumber0.15Opacity of a hidden word
wordSpannumber0.12Share of the range one word needs to fully appear
classNamestring-Classes for the paragraph
wordClassNamestring-Classes for each word