Progressive Blur
Blur content as it scrolls under an edge, inspired by the scroll edge effect in iOS 27.
Preview
Library
1,284 photos
YearsMonthsAll
const PHOTOS = Array.from({ length: 42 }, (_, index) => {
const hue = (index * 47) % 360;
const angle = (index * 67) % 360;
return `linear-gradient(${angle}deg, oklch(0.74 0.11 ${hue}), oklch(0.36 0.08 ${(hue + 60) % 360}))`;
});
export const ProgressiveBlurExample = () => (
<div className="border-border bg-background relative h-[26rem] w-full max-w-72 overflow-hidden rounded-[2rem] border [clip-path:inset(0_round_2rem)]">
<div
aria-label="Photo library"
className="focus-visible:outline-foreground h-full [scrollbar-width:none] overflow-y-auto focus-visible:outline-2 focus-visible:-outline-offset-2"
role="region"
tabIndex={0}
>
<ul className="grid grid-cols-3 gap-0.5 pt-20 pb-24" role="list">
{PHOTOS.map((photo) => (
<li
className="aspect-square"
key={photo}
style={{ backgroundImage: photo }}
/>
))}
</ul>
</div>
<div
aria-hidden="true"
className="progressive-blur-t from-background/70 progressive-blur-lg absolute inset-x-0 top-0 h-28 bg-linear-to-b to-transparent"
/>
<div className="absolute inset-x-0 top-0 flex items-end justify-between px-5 pt-6">
<div>
<p className="text-xl font-semibold tracking-tight">Library</p>
<p className="text-foreground/70 text-xs">1,284 photos</p>
</div>
<span className="bg-foreground/10 rounded-full px-3 py-1 text-xs font-medium backdrop-blur-md">
Select
</span>
</div>
<div
aria-hidden="true"
className="progressive-blur-b from-background/70 progressive-blur-lg absolute inset-x-0 bottom-0 h-28 bg-linear-to-t to-transparent"
/>
<div className="absolute inset-x-0 bottom-5 flex justify-center">
<span className="bg-foreground/10 flex gap-1 rounded-full p-1 text-xs font-medium backdrop-blur-md">
<span className="text-foreground/70 px-3 py-1">Years</span>
<span className="text-foreground/70 px-3 py-1">Months</span>
<span className="bg-foreground/15 rounded-full px-3 py-1">All</span>
</span>
</div>
</div>
);Features
- Layers two backdrop blurs, each masked to its own gradient, so the edge ramps up without steps.
- Ships as a Tailwind utility. No component, no JavaScript.
- Sets its strength with Tailwind's blur scale, from
progressive-blur-xstoprogressive-blur-3xl, or any length likeprogressive-blur-[20px]. - Pairs with a gradient tint to keep text legible over busy content.
Installation
bunx --bun shadcn@latest add https://olekaleksander.dev/r/progressive-blur.jsonUsage
Put the blur on an element that sits over the edge content scrolls under.
<header className="sticky top-0">
<div className="progressive-blur-t progressive-blur-lg absolute inset-x-0 top-0 h-20" />
</header>API Reference
| Name | Description |
|---|---|
progressive-blur-t | Strongest at the top edge, fading out downward. |
progressive-blur-b | Strongest at the bottom edge, fading out upward. |
progressive-blur-{size} | Strength, from Tailwind's blur scale: xs, sm, md, lg, xl, 2xl or 3xl. Defaults to md (12px). |
progressive-blur-[length] | Any other strength, like progressive-blur-[20px]. |