Skip to Content
Zuri
Blocks

Reveal

Fades content in as it scrolls into view, and never hides what is already on screen.

Live preview
Theme
Preview width
  1. Step 1

    Apply

  2. Step 2

    Meet your mentor

  3. Step 3

    Build a project

  4. Step 4

    Present it

  5. Step 5

    Get placed

  6. Step 6

    Mentor others

Use Reveal to bring page sections in as people scroll to them. Press Replay above to watch the cards arrive. In your own page they play as the content scrolls into view. If your system is set to reduce motion, nothing animates and the content just appears.

Content is fully visible until the page has loaded, so it works without JavaScript and search engines see everything. Anything already on screen when the page loads is left alone, so there is no flash.

Installation

pnpm dlx shadcn@latest add https://components.abdulqadirmsingi.com/r/reveal.json

Usage

import { Reveal } from "@/components/ui/reveal";

<Reveal>
  <h2>Our courses</h2>
</Reveal>

{/* Stagger siblings with small delays */}
{items.map((item, i) => (
  <Reveal key={item.id} delay={i * 80}>…</Reveal>
))}

Directions

from can be "up" (the default), "fade", "start" or "end". The last two slide sideways and flip in right-to-left layouts.

Live preview
Theme
Preview width
from="up"
from="fade"
from="start"
from="end"

Props

It extends the native <div> props and spreads them onto the element, including ref (React 19).

Props
PropTypeDefaultDescription
from"up" | "fade" | "start" | "end""up"How it arrives.
delaynumber0Milliseconds to wait before starting. Use steps of 60 to 120 to stagger siblings.
thresholdnumber0.15The fraction of the element that must be visible before it reveals, from 0 to 1.
animateOnScreenbooleanfalseAlso animate content that is already on screen at mount. Off by default, so the page doesn't flash on load. The demos on this page turn it on.
oncebooleantrueReveal once, or hide again when it scrolls out of view.
asElementType"div"The element to render, for example "li" or "section".

Accessibility

  • It is only a visual effect. The content is in the page the whole time, in reading order, and screen readers read it whether or not it has appeared.
  • It does nothing under prefers-reduced-motion: the content just shows.
  • It only moves opacity and translate, using the --duration-slow and --ease-out tokens.
  • Never put the only copy of something important, such as an error message, inside a Reveal: it can be invisible for a moment while off screen.

Tokens used

--duration-slow, --ease-out.

Known limitations

  • It watches the browser window, not a scrolling container inside the page.
  • If the browser has no IntersectionObserver, the content just shows.
  • Jumping past a section (the End key, an anchor link further down) shows it straight away, so nothing is left invisible behind you.

On this page