Skip to content

Scroll Reveal

Content that moves from an offset into place while it scrolls into view.

From the Nitip template — see it in context

1. Tied to scroll

Progress runs from the bottom of the viewport to the top of the block.

2. Reversible

Scroll back up and it plays backwards — no snapping, no easing.

Installation

$ npx shadcn@latest add https://framebrick.co/r/scroll-reveal.json

Usage

import { ScrollReveal } from "@/components/ui/scroll-reveal";

<ScrollReveal from={{ y: 60, opacity: 0 }}>
  <h2>Everything we make, in one place</h2>
</ScrollReveal>

Props

PropTypeDefaultDescription
childrenReactNode—What moves into place.
from{ x?, y?, scale?, opacity? }{ y: 60, opacity: 0 }Where it starts: pixels for x/y, a factor for scale, 0–1 for opacity.
classNamestring—Classes for the frame, which never moves.
  • Tied directly to scroll, not to a timer: progress is 0 when the block's top reaches the bottom of the viewport and 1 when its bottom does, so scrolling back up plays it backwards.
  • Static with reduced motion.

AI prompt

Paste into v0, Lovable, Bolt or Claude to rebuild this component in your own project.

Create a React + Tailwind CSS component called ScrollReveal (no animation library).
- A frame that never moves, holding the content. The content starts at a given offset ({x, y, scale, opacity})
  and reaches its resting state as the block scrolls into view.
- In a passive scroll listener: progress = (innerHeight - rect.top) / rect.height, clamped 0–1, left = 1 - progress;
  write transform = translate3d(x*left, y*left, 0) scale(1 + (scale-1)*left) and opacity = 1 + (opacity-1)*left
  straight to the element's style. Linear, no easing, reversible.
- Re-measure on resize with a ResizeObserver on document.body (images load late).
- Render the starting transform inline so there is no flash before the first scroll event.
- Skip everything when prefers-reduced-motion is set.

Be the first to know

Get new templates and components first

One short email when we release a template or a free component. No spam — unsubscribe anytime.

We use your email only for Framebrick updates. Privacy policy