Skip to content
Textlab
1
Browse

ComponentsScroll

Scroll stretch

Letters stretch tall as you scroll fast.

Flick the scroll inside the preview ↓
Elastic

Installation

$ npx shadcn@latest add @textlab/scroll-stretch

Needs @textlab in your components.json. Setup takes a minute.

Usage

usage.tsx
import { ScrollStretch } from "@/components/textlab/scroll-stretch/scroll-stretch";

<ScrollStretch as="h2" text="Elastic" />

Variants

verticalhorizontal

Props

PropTypeDefaultDescription
text*string–The copy.
variant"vertical" | "horizontal""vertical"Pull letters tall, or smear them sideways.
maxnumber0.6Largest stretch above 1.
containerRefObject<HTMLElement>–Scrollable ancestor. Defaults to the window.
asElementType"span"Rendered element.
reducedMotion"user" | "always" | "never""user"user follows the OS setting; always shows the still version.
classNamestring–Merged onto the root.

When to use it

Reach for it

  • Short, heavy display words on playful pages.
  • Section dividers that react to momentum.

Skip it

  • Long titles; per-letter springs add up.
  • Serious, text-first pages.

Accessibility and motion

Accessibility

  • Letters are aria-hidden; the word is read once.
  • Moves only during fast scrolling.

Motion

  • Each letter has its own spring, slightly softer along the word, so the stretch ripples.
  • Volume is preserved: taller letters get narrower.
Reduced motion. Still, normal letters.

Performance

  • One spring per letter. Keep it to short words.