Scroll Fade

Container edges that fade only where there is more content.

scroll-fade.tsx

Installation

1

Install the packages

npm install @prequelui/react motion

@prequelui/react reuses the primitive library your components already depend on.

2

Add the component

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/scroll-fade.json

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/scroll-fade.json

3

Turn on the motion

npx @prequelui/cli@latest animate scroll-fade

The CLI finds the component through components.json, swaps the import and removes the CSS animation classes that Motion replaces.

Usage

Import the component and compose it exactly like the primitive it wraps. Motion is enabled by default; the tempo prop scales every duration and softens every spring.

scroll-fade.tsx
import { ScrollFade } from "@/components/prequelui/effects/scroll-fade";

export default function Demo() {
  return (
    <ScrollFade size={44} className="h-40 w-[320px] overflow-y-auto rounded-xl border">
      {rows.map((row) => <p key={row}>{row}</p>)}
    </ScrollFade>
  );
}
import { ScrollFade } from "@/components/prequelui/scroll-fade";

export function Variant() {
  return (
    <ScrollFade tempo={1.2}>
      …
    </ScrollFade>
  );
}

Animation

The container paints a gradient mask on its own edges. The mask only exists on a side that still has content to reveal: at the top of the list the top fade is zero, at the bottom the bottom fade is zero, and the values settle with a short tween as you scroll.

  • Edge amount ramps over half the fade size, from 0 to 1.
  • Vertical, horizontal and both orientations are supported, including RTL.
  • Scroll and resize both re-measure; the mask is removed when no edge is active.
  • Reduced motion jumps straight to the target amount.
size 40 pxgradient maskRTL awareno mask at rest

API Reference

Each part accepts the usual HTML props in addition to the motion props below. No accessibility prop is hidden behind the animation layer.

ScrollFade

PropTypeDefault
orientation"vertical" | "horizontal" | "both""vertical"
sizenumber40
enabledbooleantrue
transitionTransitioncomponent spring or tween
asChildbooleanfalse
classNamestring—

Built by Vidhal. The source is available on GitHub.

Last updated: 11/17/2026