Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Fade In

Free

Reveals children on scroll with direction, distance and blur controls.

Installation

pnpm dlx shadcn@latest add @viewport/fade-in

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above.

fade-in-demo.tsx
import { FadeIn } from "@/components/viewport/fade-in";

export default function FadeInDemo() {
  return (
    <div className="grid w-full max-w-2xl grid-cols-1 gap-4 sm:grid-cols-3">
      {(["left", "bottom", "right"] as const).map((from, i) => (
        <FadeIn key={from} from={from} delay={i * 0.12} repeat>
          <div className="rounded-2xl border border-border bg-card p-6 text-center">
            <p className="text-sm font-medium">From {from}</p>
            <p className="mt-1 text-xs text-muted-foreground">Scroll away and back to replay.</p>
          </div>
        </FadeIn>
      ))}
    </div>
  );
}

Props

PropTypeDefault
from"bottom" | "top" | "left" | "right" | "none"

Direction the element travels from.

"bottom"
distancenumber

Travel distance in pixels.

20
delaynumber0
durationnumber0.7
blurboolean

Add a blur that clears as the element arrives.

true
repeatboolean

Replay every time the element re-enters the viewport.

false
classNamestring—
children*React.ReactNode—

Accessibility

  • Renders children immediately under reduced motion.
  • Content is in the DOM from the start, so it is always crawlable.