Skip to content

Progressive Blur

Blur content as it scrolls under an edge, inspired by the scroll edge effect in iOS 27.

Preview

Library

1,284 photos

Select
YearsMonthsAll
import { For } from "solid-js";

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 class="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"
      class="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 class="grid grid-cols-3 gap-0.5 pt-20 pb-24" role="list">
        <For each={PHOTOS}>
          {(photo) => (
            <li class="aspect-square" style={{ "background-image": photo }} />
          )}
        </For>
      </ul>
    </div>

    <div
      aria-hidden="true"
      class="progressive-blur-t from-background/70 progressive-blur-lg absolute inset-x-0 top-0 h-28 bg-linear-to-b to-transparent"
    />
    <div class="absolute inset-x-0 top-0 flex items-end justify-between px-5 pt-6">
      <div>
        <p class="text-xl font-semibold tracking-tight">Library</p>
        <p class="text-foreground/70 text-xs">1,284 photos</p>
      </div>
      <span class="bg-foreground/10 rounded-full px-3 py-1 text-xs font-medium backdrop-blur-md">
        Select
      </span>
    </div>

    <div
      aria-hidden="true"
      class="progressive-blur-b from-background/70 progressive-blur-lg absolute inset-x-0 bottom-0 h-28 bg-linear-to-t to-transparent"
    />
    <div class="absolute inset-x-0 bottom-5 flex justify-center">
      <span class="bg-foreground/10 flex gap-1 rounded-full p-1 text-xs font-medium backdrop-blur-md">
        <span class="text-foreground/70 px-3 py-1">Years</span>
        <span class="text-foreground/70 px-3 py-1">Months</span>
        <span class="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-xs to progressive-blur-3xl, or any length like progressive-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.json

Usage

Put the blur on an element that sits over the edge content scrolls under.

<header class="sticky top-0">
  <div class="progressive-blur-t progressive-blur-lg absolute inset-x-0 top-0 h-20" />
</header>

API Reference

NameDescription
progressive-blur-tStrongest at the top edge, fading out downward.
progressive-blur-bStrongest 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].