GooseUI

Components

Reveal on Scroll


Elements reveal with animation as they enter the viewport using CSS scroll-driven animations with view() timeline.

Browser Support

Scroll-driven animations

Reveals elements as they enter the viewport.

Your browser:

Preview

Scroll down ↓

Keep scrolling: each card appears as it enters the window.

Direction: up

This card is revealed by the scroll position of the window.

Direction: left

This card is revealed by the scroll position of the window.

Direction: right

This card is revealed by the scroll position of the window.

Direction: fade

This card is revealed by the scroll position of the window.

Direction: down

This card is revealed by the scroll position of the window.

Direction: up

This card is revealed by the scroll position of the window.

Direction: left

This card is revealed by the scroll position of the window.

Direction: right

This card is revealed by the scroll position of the window.

Direction: fade

This card is revealed by the scroll position of the window.

Direction: down

This card is revealed by the scroll position of the window.

Installation

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

Usage

import { RevealOnScroll, RevealOnScrollStyles } from "@/components/effects/reveal-on-scroll"

// Add styles once in your layout
<RevealOnScrollStyles />

// Use component
<RevealOnScroll direction="up">
  <div>This reveals from below</div>
</RevealOnScroll>

<RevealOnScroll direction="left" delay={200}>
  <div>This reveals from right with delay</div>
</RevealOnScroll>

How it works

.reveal-on-scroll {
  animation: reveal-up linear both;
  animation-timeline: view();
  animation-range: entry 0% entry 100%;
}

@keyframes reveal-up {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

Props

PropTypeDefaultDescription
direction"up" | "down" | "left" | "right" | "fade""up"Animation direction
delaynumber0Animation delay in ms
durationnumber600Animation duration in ms
classNamestring-Additional CSS classes