Components

Blur Panel

A React backdrop-blur panel for sticky headers, floating toolbars and sidebars. Built with Motion's useScroll and Tailwind CSS, its blur, saturation and tint fade in as the page scrolls — without re-rendering — and it falls back to a solid fill where backdrop-filter isn't available.

  • Scroll-linked blur
  • Sticky header
  • Intensity presets
  • No re-renders
  • Any landmark element
dusk.blog

Journal

Notes on interface design

Designing with light

As the page scrolls, the header picks up blur, saturation and tint — the colors underneath stay visible without hurting legibility.

Motion that respects users

As the page scrolls, the header picks up blur, saturation and tint — the colors underneath stay visible without hurting legibility.

The case for glass

As the page scrolls, the header picks up blur, saturation and tint — the colors underneath stay visible without hurting legibility.

Installation

$ npx shadcn@latest add https://duskui.com/r/blur-panel.json

The panel doesn't position itself — add sticky top-0, fixed or whatever your layout needs through className.

Usage

site-header.tsx
import { BlurPanel } from "@/components/dusk/glass/blur-panel"

export function SiteHeader() {
  return (
    <BlurPanel as="header" className="sticky top-0 z-40 flex h-16 items-center px-6">
      <Logo />
      <Nav />
    </BlurPanel>
  )
}

Examples

Floating toolbar

Set scrollRange={false} for a panel that is always frosted, and edge="none" when the shape is rounded. Here a strong, pill-shaped toolbar floats over a scrolling photo grid.

Intensity

intensity takes a preset — subtle, medium, strong — or a number from 0 to 1. It scales blur (up to 24px), saturation and tint together so the panel stays balanced.

intensity="subtle"

Always frosted — handy for sidebars and docked panels.

intensity="medium"

Always frosted — handy for sidebars and docked panels.

intensity="strong"

Always frosted — handy for sidebars and docked panels.

API Reference

Also accepts every <div> prop. Pass container when the panel lives inside its own scroll area instead of the page.

PropTypeDefaultDescription
as"div" | "header" | "nav" | "aside" | "footer" | "section""div"Element to render — pick the right landmark.
intensity"subtle" | "medium" | "strong" | number"medium"How frosted the panel gets. Numbers go from 0 to 1.
scrollRange[number, number] | false[0, 80]Scroll distance in px over which the glass fades in. false = always frosted.
containerRefObject<HTMLElement | null>—Scroll container to watch. Defaults to the page.
edge"top" | "right" | "bottom" | "left" | "none""bottom"Side that gets a hairline as the panel frosts.

Accessibility

  • Render it as a landmark with as="header", "nav" or "aside", and give navs an aria-label.
  • The tint scales with the blur, and browsers without backdrop-filter get a near-opaque fill, so content under the panel never makes its text unreadable.
  • Nothing moves: only blur, tint and a hairline fade with scroll, so it's comfortable with reduced motion. Scroll is read through motion values and never re-renders React.
  • If you put the panel inside its own scroll area, make that area focusable (tabIndex={0}) with a label so keyboard users can scroll it.