Blur drawer

drawer-blur is a set of five decorative bottom drawers (SoftBlurDrawer, HeavyBlurDrawer, DarkBlurDrawer, TintBlurDrawer, GradientBlurDrawer) that share one shell. The opaque panel stays the same across variants while each variant changes only the backdrop scrim and blur, and every variant slides up from the bottom edge with motion/react.

componentstyleddrawerregistry-item.json
Blur drawer
LIVE · running in a sandboxed iframe
Installed with shadcn add · 2 workarounds · theme from registry.json
  • applied the registry's theme (tokens, fonts and CSS from the registry preview settings)
  • installed base item https://ai2.design/r/tokens.json (registry preview settings)
See how it was built

Installation

pnpm dlx shadcn@latest add @ai2/drawer-blur

Requires @ai2 in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import { HeavyBlurDrawer } from "@/components/ui/drawer-blur"export default function Demo() {  return (    <HeavyBlurDrawer title="Filters" trigger="Open filters">      <p>Choose the options you want to apply.</p>    </HeavyBlurDrawer>  )}
  • Use a bottom sheet with a blurred or tinted backdrop for secondary actions, filters, or short forms on mobile-style layouts.
  • Pick the variant by mood: SoftBlurDrawer for subtle focus, HeavyBlurDrawer for strong separation, DarkBlurDrawer for high contrast, TintBlurDrawer for brand-colored emphasis, GradientBlurDrawer for a cinematic top-to-bottom fade.
  • Use it when you want a decorative drawer with no Radix or Vaul dependency and no portal, since it is fully self-contained with a fixed overlay.
  • Choose it over a centered dialog when content is better presented as a panel rising from the bottom edge.

Examples

Uncontrolled drawer with a text trigger

The drawer manages its own open state. The trigger prop given as a string is rendered inside the default styled button.

uncontrolled-drawer-with-a-text-trigger.tsx
import { HeavyBlurDrawer } from "@/components/ui/drawer-blur"export default function Demo() {  return (    <HeavyBlurDrawer size="lg" title="Filters" trigger="Filters">      <p>Pick the options you want to apply.</p>    </HeavyBlurDrawer>  )}

Controlled drawer

The parent owns the open state through open and onOpenChange, so it can be closed programmatically from inside the content.

controlled-drawer.tsx
import * as React from "react"import { SoftBlurDrawer } from "@/components/ui/drawer-blur"export default function Demo() {  const [open, setOpen] = React.useState(false)  return (    <SoftBlurDrawer open={open} onOpenChange={setOpen} title="Confirm order" trigger="Review order">      <button type="button" onClick={() => setOpen(false)}>Done</button>    </SoftBlurDrawer>  )}

Custom trigger element

A ReactElement passed as trigger is cloned so the drawer can add aria-haspopup, aria-expanded, and the open click handler directly to that button.

custom-trigger-element.tsx
import { TintBlurDrawer } from "@/components/ui/drawer-blur"export default function Demo() {  return (    <TintBlurDrawer      size="sm"      title="Share"      trigger={<button type="button" className="rounded-md border px-3 py-1.5">Share</button>}    >      <p>Copy the link to share this page.</p>    </TintBlurDrawer>  )}

Full-height gradient drawer open by default

GradientBlurDrawer at xl size, opened on mount with defaultOpen. Long content scrolls inside the panel.

full-height-gradient-drawer-open-by-default.tsx
import { GradientBlurDrawer } from "@/components/ui/drawer-blur"export default function Demo() {  return (    <GradientBlurDrawer size="xl" defaultOpen title="Welcome" trigger="Start">      <p>Long content scrolls inside the panel.</p>    </GradientBlurDrawer>  )}

API reference

PropTypeDefaultDescription
size"sm" | "md" | "lg" | "xl""md"Panel height: sm is 35vh, md is 50vh, lg is 68vh, xl is 82vh. Exported type StyledSize.
triggerReact.ReactNode—Trigger content. If it is a valid React element it is cloned as the trigger and receives aria-haspopup, aria-expanded, and an onClick that also calls its original onClick. Otherwise it is rendered inside a default styled button, which shows "Open" when no trigger is given.
titleReact.ReactNode—Heading rendered as an h2 at the top of the panel. When omitted, an empty span keeps the layout.
childrenReact.ReactNode—Body content rendered inside the scrollable area of the panel.
classNamestring—Extra classes merged onto the panel element via cn().
openboolean—Controlled open state. When provided (not undefined), the component is controlled and internal state is ignored.
defaultOpenbooleanfalseInitial open state when uncontrolled.
onOpenChange(o: boolean) => void—Called with the next open state whenever the drawer opens or closes (trigger click, backdrop click, Escape, close button).

Accessibility

  • The panel has role="dialog" and aria-modal="true" and receives focus on open through requestAnimationFrame, so keyboard users land inside the drawer.
  • The trigger carries aria-haspopup="dialog" and aria-expanded reflecting the open state. It is the real button, not a wrapper, so there is a single focusable control.
  • Escape closes the drawer through a window keydown listener, and the close button has aria-label="Close".
  • The backdrop is a click-only div and is not keyboard operable, so keyboard users rely on Escape or the close button.
  • The component does not trap focus or restore focus to the trigger on close. Add those behaviors in the consuming code if strict modal semantics are required.
  • Provide a title so the dialog has an accessible name, because the source does not set aria-labelledby and a panel without a title has no name.
  • The handle bar is decorative and is not announced.
  • Under prefers-reduced-motion the slide is removed and only an opacity fade plays.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Blur drawer" component (ai2/drawer-blur) from its shadcn registry.1. Install it with: npx shadcn@latest add @ai2/drawer-blur2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: size, trigger, title, children, className, open, defaultOpen, onOpenChange.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { HeavyBlurDrawer } from "@/components/ui/drawer-blur"export default function Demo() {  return (    <HeavyBlurDrawer title="Filters" trigger="Open filters">      <p>Choose the options you want to apply.</p>    </HeavyBlurDrawer>  )}```

Files & dependencies

  • registry/ai2/styled/drawer-blur.tsx→ components/ui/drawer-blur.tsx
dependenciesmotion@^12.42.2lucide-react@^1.23.0
registryDependencies@ai2/tokens

Looks similar, elsewhere