When to use
- A header or toolbar floating over a scrolling list, where content should soften as it passes under instead of meeting a hard frosted strip.
- A bottom bar or a chat composer over a feed or a conversation.
- Any edge where the blur should appear only once content is actually underneath: link it to the scroller.
When not to use
- Fading a scroller's own edges where there is more to scroll, with no bar on top: use a Scroll Area.
- A solid header that content scrolls behind out of sight: a plain background is cheaper.
Installation
pnpm dlx shadcn add https://eased.dev/r/progressive-blur.jsonnpx shadcn add https://eased.dev/r/progressive-blur.jsonyarn dlx shadcn add https://eased.dev/r/progressive-blur.jsonbunx --bun shadcn add https://eased.dev/r/progressive-blur.jsonThe command adds Progressive Blur, everything it builds on and Eased’s tokens to your project.
Install the dependencies
pnpm add motionnpm install motionyarn add motionbun add motionAdd the Eased pieces it builds on
Copy each item’s files the same way, or install them with the CLI:
Copy the source into your project
components/eased/progressive-blur/progressive-blur.tsxTSX "use client";import { motion, useMotionValue, type MotionValue } from "motion/react";import { useEffect, useLayoutEffect, useState, type CSSProperties, type RefObject } from "react";import { BlurStack, observeScrollContent, type BlurSide } from "../_primitives/scroll-fade/scroll-fade";export type ProgressiveBlurProps = { /** The edge the blur is strongest at; it sits flush against that edge of its positioned parent. Default "top". */ side?: BlurSide; /** How far the ramp reaches in from the edge, px. Default 80. */ size?: number; /** Blur at the edge, px. Default 20. */ maxBlur?: number; /** Stacked layers; more is smoother and costs more. Default 6. */ layers?: number; /** Lay a surface-coloured scrim under the ramp so text over busy content stays legible. Default true. */ tint?: boolean; /** * Scroll-linked strength: the blur fades in as content scrolls under the edge and is gone * when nothing is there (top: scrolled to the start; bottom: scrolled to the end). A ref or * the element itself; a ref whose scroller mounts later links on the next render, and an * element held in state (from a callback ref) links as soon as it exists. */ scrollRef?: RefObject<HTMLElement | null> | HTMLElement | null; /** Scroll distance (px) over which a scroll-linked blur reaches full strength. Default `size`. */ scrollRange?: number; /** Manual strength, 0–1, when there is no `scrollRef`. Default 1. */ strength?: number | MotionValue<number>; /** Position and stacking, e.g. `z-10`. Do not set opacity, filter or mask here: they blank the blur. */ className?: string;};const PLACE: Record<BlurSide, string> = { top: "inset-x-0 top-0", bottom: "inset-x-0 bottom-0", left: "inset-y-0 left-0", right: "inset-y-0 right-0",};const TINT: Record<BlurSide, string> = { top: "bg-linear-to-b", bottom: "bg-linear-to-t", left: "bg-linear-to-r", right: "bg-linear-to-l",};/** * Progressive Blur: a blur that ramps from nothing to `maxBlur` over `size` px toward an edge, * built from stacked masked backdrop layers, for headers, bottom bars and composers. Linked to a * scroller, it only appears once there is content underneath to blur. */export function ProgressiveBlur({ side = "top", size = 80, maxBlur = 20, layers = 6, tint = true, scrollRef, scrollRange, strength = 1, className = "",}: ProgressiveBlurProps) { const linked = useMotionValue(scrollRef ? 0 : 1); const range = scrollRange ?? size; // Resolve the scroller after commit, so a ref filled by a later-mounting scroller still links. const [el, setEl] = useState<HTMLElement | null>(null); // No deps on purpose: a ref's `.current` changes without a render to key on. // eslint-disable-next-line react-hooks/exhaustive-deps useLayoutEffect(() => { const next = scrollRef instanceof HTMLElement ? scrollRef : (scrollRef?.current ?? null); if (next !== el) setEl(next); }); useEffect(() => { if (!el) return; const update = () => { const vertical = side === "top" || side === "bottom"; const pos = vertical ? el.scrollTop : Math.abs(el.scrollLeft); const max = vertical ? el.scrollHeight - el.clientHeight : el.scrollWidth - el.clientWidth; const under = side === "top" || side === "left" ? pos : max - pos; linked.set(Math.min(1, Math.max(0, under / range))); }; update(); el.addEventListener("scroll", update, { passive: true }); const unobserve = observeScrollContent(el, update); return () => { el.removeEventListener("scroll", update); unobserve(); }; }, [el, side, range, linked]); const level = scrollRef ? linked : strength; const extent: CSSProperties = side === "top" || side === "bottom" ? { height: size } : { width: size }; return ( <div aria-hidden className={`pointer-events-none absolute ${PLACE[side]} ${className}`} style={extent}> {tint && <motion.div className={`absolute inset-0 ${TINT[side]} from-surface/75 via-surface/30 to-transparent`} style={{ opacity: level }} />} <BlurStack side={side} layers={layers} maxBlur={maxBlur} strength={level} /> </div> );}Keep the folder layout
The files import each other by relative path (
../lib/motion), so keep each one at the path shown, undercomponents/eased/.
Usage
Place it as a sibling over the scroller, in a positioned parent, and render the header after it.
import { useRef } from "react";import { ProgressiveBlur } from "@/components/eased/progressive-blur/progressive-blur";export function Inbox() { const scroller = useRef<HTMLDivElement>(null); return ( <div className="relative h-96"> <div ref={scroller} className="h-full overflow-y-auto pt-12">…</div> <ProgressiveBlur side="top" size={72} scrollRef={scroller} /> <header className="absolute inset-x-0 top-0 h-12">Inbox</header> </div> );}Examples
Under a composer
At the bottom edge, a linked blur shows while there is more below and fades out at the end of the conversation.
<div className="relative h-[32rem]"> <div ref={thread} className="h-full overflow-y-auto pb-24">…</div> <ProgressiveBlur side="bottom" size={96} scrollRef={thread} className="z-10" /> <div className="absolute inset-x-3 bottom-3 z-20"> <Composer onSubmit={send} /> </div></div>Fixed strength
Without a scroller, set strength (a number or a MotionValue from 0 to 1).
<ProgressiveBlur side="bottom" strength={0.6} tint={false} />API reference
ProgressiveBlur
| Prop | Type | Default | Description |
|---|---|---|---|
side | "top" | "bottom" | "left" | "right" | "top" | The edge the blur is strongest at; it pins itself flush to that edge. |
size | number | 80 | Ramp length in px. |
maxBlur | number | 20 | Blur at the edge, px. |
layers | number | 6 | More is smoother and costs more GPU. At least 2. |
tint | boolean | true | A surface-coloured scrim under the ramp, so text over busy content stays legible. |
scrollRef | RefObject<HTMLElement | null> | HTMLElement | null | Links strength to scroll. Top and left fade in as you scroll away from the start; bottom and right show while there is more to scroll. | |
scrollRange | number | size | Scroll distance to full strength, px. |
strength | number | MotionValue<number> | 1 | Strength from 0 to 1, when there is no scrollRef. |
className | string | "" | Position and stacking, e.g. z-10. |
A ref whose scroller mounts later links on the next render. Rows added or resized later re-measure at once.
Accessibility
- It is
aria-hiddenand never takes pointer events, so clicks and scrolling pass through to the content underneath. - The tint keeps text in the header legible over busy content; keep it on unless the bar has its own background.
Motion
Six stacked backdrop layers, each double the last one's radius and masked to an overlapping band, so content softens gradually toward the edge. Linked to a scroller, strength follows the scroll position directly, with no animation of its own, so reduced motion needs no separate branch. Browsers without backdrop-filter show the tint only.
Notes for AI
Put ProgressiveBlur as a sibling of the scroller, not inside it (it would scroll away), in a parent with position: relative, and render the header or bar after it so the bar sits on top. Pass scrollRef whenever there is a scroller, so the blur is gone when nothing is underneath.
Do not put opacity, filter or mask on it or on any ancestor up to the scroller: any of them becomes the backdrop root and the blur goes blank. That is why strength is applied as each layer's own opacity; fade it with strength, never with a wrapper.
Related components
- Custom Scrollbar (Scroll Area): a scroller whose edges fade where there is more.
- AI Chat Input: a message input to float over a conversation.
- Squircle Smooth Corners