Mohammad Shehadeh

Scroll Reveal

Component

About

Fades and slides content in from any direction as it enters the viewport. Configurable distance, delay and replay; respects reduced-motion.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Scroll Reveal to your project and fits it to your theme.

Code

How Scroll Reveal is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

'use client';

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

export default function ScrollRevealDemo() {
  const items = [
    { dir: 'up' as const, label: 'Up' },
    { dir: 'right' as const, label: 'Right' },
    { dir: 'left' as const, label: 'Left' },
    { dir: 'down' as const, label: 'Down' },
  ];

  return (
    <div className="grid w-full max-w-xl gap-6">
      <ScrollReveal>
        <p className="text-xs text-muted-foreground uppercase">Reveal on scroll</p>
      </ScrollReveal>
      <div className="grid grid-cols-2 gap-3">
        {items.map((item, i) => (
          <ScrollReveal key={item.dir} direction={item.dir} delay={i * 100}>
            <div className="flex h-24 flex-col justify-between rounded-md border border-border bg-card p-4">
              <span className="text-xs text-muted-foreground uppercase">{`from ${item.label.toLowerCase()}`}</span>
              <span className="text-sm font-medium text-foreground">{item.label}</span>
            </div>
          </ScrollReveal>
        ))}
      </div>
    </div>
  );
}

Dependencies

More by Mohammad Shehadeh

View all
  • Feature Problem Cards

    Feature Problem Cards

    84
  • Feature Grid Spotlight Cards

    Feature Grid Spotlight Cards

    70
  • Dithered Shader CTA

    Dithered Shader CTA

    63
  • Ecommerce Category Page

    Ecommerce Category Page

    61
  • Split Login

    Split Login

    60
  • Comparison Table

    Comparison Table

    59
  • FAQ Two Column

    FAQ Two Column

    59
  • Comparison Section

    Comparison Section

    57

Explore more

Part of Hirael — browse the full library on 21st.dev.