Progressive Blur
A progressive blur effect for React and Tailwind CSS: stacked backdrop-filter bands with overlapping gradient masks fade scrolling content into a smooth blur at any edge, like the toolbars in iOS and macOS. Pure CSS with no JavaScript, so it works in Server Components and costs nothing at runtime.
- Pure CSS
- Server Component
- Any edge
- Smooth multi-layer ramp
- pointer-events: none
- 13:42
Midnight Static
Neon Harbor
- 24:05
Glass Rain
Lumen
- 32:58
After Hours
Kilo Vale
- 43:21
Low Orbit
Satellite Bloom
- 55:10
Soft Circuit
Neon Harbor
- 63:33
Paper Moons
Ivy & Ash
- 74:47
Undertow
Lumen
- 83:02
Static Bloom
Kilo Vale
- 94:18
Northern Lines
Satellite Bloom
- 103:55
Velvet Hour
Ivy & Ash
import { ProgressiveBlur } from "@/components/dusk/progressive-blur/progressive-blur";
const tracks = [
{ title: "Midnight Static", artist: "Neon Harbor", time: "3:42", tone: 160 },
{ title: "Glass Rain", artist: "Lumen", time: "4:05", tone: 300 },
{ title: "After Hours", artist: "Kilo Vale", time: "2:58", tone: 40 },
{ title: "Low Orbit", artist: "Satellite Bloom", time: "3:21", tone: 220 },
{ title: "Soft Circuit", artist: "Neon Harbor", time: "5:10", tone: 150 },
{ title: "Paper Moons", artist: "Ivy & Ash", time: "3:33", tone: 20 },
{ title: "Undertow", artist: "Lumen", time: "4:47", tone: 320 },
{ title: "Static Bloom", artist: "Kilo Vale", time: "3:02", tone: 190 },
{ title: "Northern Lines", artist: "Satellite Bloom", time: "4:18", tone: 250 },
{ title: "Velvet Hour", artist: "Ivy & Ash", time: "3:55", tone: 350 },
];
export default function ProgressiveBlurDemo() {
return (
// The blur sits on a non-scrolling wrapper so it stays pinned while the list moves.
<div className="relative h-96 w-full max-w-sm overflow-hidden rounded-xl border border-white/10 bg-background">
<div
role="region"
tabIndex={0}
aria-label="Playlist"
className="h-full overflow-y-auto overscroll-contain px-3 py-10 outline-none focus-visible:ring-[3px] focus-visible:ring-inset focus-visible:ring-ring/50"
>
<ol className="space-y-1">
{tracks.map((track, i) => (
<li key={track.title} className="flex items-center gap-3 rounded-lg p-2 hover:bg-white/[0.04]">
<span className="w-5 text-right text-xs text-white/55 tabular-nums">{i + 1}</span>
<div className="size-11 shrink-0 rounded-md" style={{ background: `oklch(0.32 0.04 ${track.tone})` }} />
<div className="min-w-0 flex-1">
<p className="truncate text-sm font-medium text-white">{track.title}</p>
<p className="truncate text-xs text-white/50">{track.artist}</p>
</div>
<span className="text-xs text-white/55 tabular-nums">{track.time}</span>
</li>
))}
</ol>
</div>
<ProgressiveBlur position="both" height={72} blurIntensity={10} />
</div>
);
}Installation
$ npx shadcn@latest add https://duskui.com/r/progressive-blur.json1. Copy the source into
components/dusk/progressive-blur/progressive-blur.tsx.progressive-blur.tsx import * as React from "react"; import { cn } from "@/lib/utils"; type Edge = "top" | "bottom" | "left" | "right"; export interface ProgressiveBlurProps extends Omit<React.ComponentProps<"div">, "children"> { /** Edge the blur builds toward. `both` blurs the top and the bottom. */ position?: Edge | "both"; /** Blur in px at the very edge. Each band inward halves it. */ blurIntensity?: number; /** Depth of the blurred band, measured inward from the edge (any CSS length or px). */ height?: number | string; /** Number of stacked bands. More bands give a smoother ramp at a small GPU cost. */ layers?: number; /** Optional color that fades in toward the edge on top of the blur, e.g. `var(--background)`. */ tint?: string; } const placement: Record<Edge, 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", }; function Band({ edge, blurIntensity, size, layers, tint, }: { edge: Edge; blurIntensity: number; size: string; layers: number; tint?: string; }) { const vertical = edge === "top" || edge === "bottom"; const n = Math.max(2, Math.round(layers)); // Each band covers a window three segments wide that slides toward the edge; // windows overlap, so the blur ramps up smoothly instead of in visible steps. const segment = 100 / (n + 1); const bands = Array.from({ length: n }, (_, i) => { const p = (k: number) => `${Math.min(100, Math.max(0, k * segment)).toFixed(2)}%`; const last = i === n - 1; const stops = last ? `transparent ${p(i)}, black ${p(i + 1)}` : `transparent ${p(i)}, black ${p(i + 1)}, black ${p(i + 2)}, transparent ${p(i + 3)}`; const mask = `linear-gradient(to ${edge}, ${stops})`; const blur = `blur(${(blurIntensity / 2 ** (n - 1 - i)).toFixed(2)}px)`; return { mask, blur }; }); return ( <div className={cn("absolute", placement[edge])} style={vertical ? { height: size } : { width: size }} > {bands.map(({ mask, blur }, i) => ( <div key={i} className="absolute inset-0" style={{ backdropFilter: blur, WebkitBackdropFilter: blur, maskImage: mask, WebkitMaskImage: mask, }} /> ))} {tint && ( <div className="absolute inset-0" style={{ backgroundImage: `linear-gradient(to ${edge}, transparent, ${tint})` }} /> )} </div> ); } /** * Fades content into a smooth, progressive blur at the edge of a container: * a stack of `backdrop-filter` bands with overlapping gradient masks, each * stronger than the last, so the blur ramps up instead of stopping at a hard line. * * Place it inside a positioned parent that does not scroll (wrap your scroll * container) so it stays pinned to the edge. Pure CSS: no JavaScript, no * animation, renders in Server Components and never takes pointer events. * Without `backdrop-filter` support only the optional `tint` remains. */ export function ProgressiveBlur({ position = "bottom", blurIntensity = 12, height = "30%", layers = 6, tint, className, ...props }: ProgressiveBlurProps) { const size = typeof height === "number" ? `${height}px` : height; const edges: Edge[] = position === "both" ? ["top", "bottom"] : [position]; return ( <div aria-hidden data-slot="progressive-blur" className={cn("pointer-events-none absolute inset-0 z-10 overflow-hidden", className)} {...props} > {edges.map((edge) => ( <Band key={edge} edge={edge} blurIntensity={blurIntensity} size={size} layers={layers} tint={tint} /> ))} </div> ); }
Usage
import { ProgressiveBlur } from "@/components/dusk/progressive-blur/progressive-blur"
export function Feed() {
return (
// The wrapper doesn't scroll, so the blur stays pinned to its edge.
<div className="relative h-96 overflow-hidden rounded-xl">
<div className="h-full overflow-y-auto">{/* long content */}</div>
<ProgressiveBlur position="bottom" height={96} blurIntensity={12} />
</div>
)
}Examples
Horizontal gallery
Use left and right for sideways scrollers. On side edges height is the depth of the band, i.e. its width.
import { ProgressiveBlur } from "@/components/dusk/progressive-blur/progressive-blur";
const hues = [160, 300, 40, 220, 150, 20, 320, 190];
export default function ProgressiveBlurGallery() {
return (
<div className="relative w-full max-w-2xl overflow-hidden rounded-xl border border-white/10 bg-background">
<div
role="region"
tabIndex={0}
aria-label="Gallery, scroll sideways"
className="flex gap-3 overflow-x-auto overscroll-x-contain px-16 py-5 outline-none focus-visible:ring-[3px] focus-visible:ring-inset focus-visible:ring-ring/50"
>
{hues.map((hue, i) => (
<figure key={hue} className="shrink-0">
<div className="h-40 w-32 rounded-lg" style={{ background: `oklch(0.32 0.04 ${hue})` }} />
<figcaption className="mt-2 text-xs text-white/50">Frame {String(i + 1).padStart(2, "0")}</figcaption>
</figure>
))}
</div>
<ProgressiveBlur position="left" height={80} blurIntensity={8} />
<ProgressiveBlur position="right" height={80} blurIntensity={8} />
</div>
);
}Intensity & height
blurIntensity is the blur in px at the very edge; each band inward halves it. height accepts px or any CSS length, and layers trades smoothness for GPU work.
Night falls over the city as signs flicker on one by one, painting wet streets in mint, violet and amber. Night falls over the city as signs flicker on one by one, painting wet streets in mint, violet and amber.
blurIntensity=4Night falls over the city as signs flicker on one by one, painting wet streets in mint, violet and amber. Night falls over the city as signs flicker on one by one, painting wet streets in mint, violet and amber.
blurIntensity=12Night falls over the city as signs flicker on one by one, painting wet streets in mint, violet and amber. Night falls over the city as signs flicker on one by one, painting wet streets in mint, violet and amber.
blurIntensity=32import { ProgressiveBlur } from "@/components/dusk/progressive-blur/progressive-blur";
const levels = [
{ blurIntensity: 4, height: "40%" },
{ blurIntensity: 12, height: "55%" },
{ blurIntensity: 32, height: "70%" },
];
const text =
"Night falls over the city as signs flicker on one by one, painting wet streets in mint, violet and amber.";
export default function ProgressiveBlurIntensity() {
return (
<div className="grid w-full max-w-2xl gap-3 sm:grid-cols-3">
{levels.map((level) => (
<div
key={level.blurIntensity}
className="relative h-56 overflow-hidden rounded-xl border border-white/10 bg-card p-4"
>
<p className="text-sm leading-relaxed text-white/85">
{text} {text}
</p>
<ProgressiveBlur position="bottom" blurIntensity={level.blurIntensity} height={level.height} />
<code className="absolute bottom-3 left-4 z-20 font-mono text-[11px] text-white">
blurIntensity={level.blurIntensity}
</code>
</div>
))}
</div>
);
}Caption card
A strong blur plus a tint makes a legible caption area over busy imagery without a hard scrim edge.
Collection
Aurora Studies
Twelve long exposures shot above the Arctic Circle.
import { ProgressiveBlur } from "@/components/dusk/progressive-blur/progressive-blur";
export default function ProgressiveBlurCard() {
return (
<article className="relative h-80 w-full max-w-xs overflow-hidden rounded-xl border border-white/10 bg-[linear-gradient(160deg,oklch(0.5_0.05_230),oklch(0.22_0.03_260))]">
<ProgressiveBlur position="bottom" height="55%" blurIntensity={24} tint="rgb(0 0 0 / 0.45)" />
<div className="absolute inset-x-0 bottom-0 z-20 p-5">
<p className="text-xs text-white/70">Collection</p>
<h3 className="mt-1 text-xl font-semibold text-white">Aurora Studies</h3>
<p className="mt-1 text-sm text-white/75">Twelve long exposures shot above the Arctic Circle.</p>
</div>
</article>
);
}API Reference
Also accepts any HTML attribute for the overlay. Place it inside a positioned parent.
| Prop | Type | Default | Description |
|---|---|---|---|
| position | "top" | "bottom" | "left" | "right" | "both" | "bottom" | Edge the blur builds toward. both = top and bottom. |
| blurIntensity | number | 12 | Blur in px at the edge; each band inward halves it. |
| height | number | string | "30%" | Depth of the band from the edge, in px or any CSS length. |
| layers | number | 6 | Number of stacked bands (min 2). |
| tint | string | — | Optional color that fades in toward the edge, e.g. var(--background). |
| className | string | — | Classes for the overlay (e.g. z-index or rounded corners). |
Accessibility
- The overlay is aria-hidden and pointer-events: none, so content underneath stays clickable, selectable and scrollable.
- Nothing animates; the effect is static CSS and unaffected by motion preferences.
- Keep important text out of the blurred band, or add padding to the scroll container so it can scroll clear of it.
- Without backdrop-filter support only the optional tint is drawn and content stays fully readable.