Notification stack
BlockStacked notifications that fan out on hover or focus.
pnpm dlx shadcn@latest add https://caliperui.site/r/notification-stack.jsonExport ready
report-q3.csv is ready to download.
Draft saved
Pricing page · 2 minutes ago
Invite accepted
Sam joined Atlas platform.
When to use #
Use it for
- Showing several recent updates compactly.
Skip it when
- One message at a time is enough.
Installation #
pnpm dlx shadcn@latest add https://caliperui.site/r/notification-stack.json
Adds its 3 files to components/ui/, each with its own stylesheet, and installs their packages. No account needed. The first part also adds Caliper UI’s tokens; import them once as in Installation.
Usage #
This is the code behind the preview above.
import { useState } from "react" import { NotificationStack, type StackNotification } from "@/components/ui/notification-stack" export function NotificationStackDemo() { const [, setLog] = useState(""); const [stack, setStack] = useState<StackNotification[]>([ { id: "s1", title: "Export ready", body: "report-q3.csv is ready to download.", action: { label: "Download", onClick: () => setLog("Downloading report-q3.csv") } }, { id: "s2", title: "Draft saved", body: "Pricing page · 2 minutes ago" }, { id: "s3", title: "Invite accepted", body: "Sam joined Atlas platform." }, ]); return ( <NotificationStack className="max-w-sm" notifications={stack} onDismiss={(id) => setStack((l) => l.filter((n) => n.id !== id))} onClear={() => setStack([])} /> ); }
API reference #
NotificationStack
component
Accessibility #
It exposes group and status semantics, with aria-label, aria-expanded, aria-hidden, aria-live and aria-relevant kept in step with state. Changes that matter are announced through a live region.
Motion #
It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.