Skip to content
Haze UI

Notification stack

Dismissible updates with a layered stack and swipe dismissal. A promise row morphs from spinner to success or error.

pnpm dlx shadcn@latest add @haze/notification-stack
Open preview in a new tab
Livesmall script

When to use

  • A panel lists recent events people can read at their own pace
  • Each event can be independently dismissed for the current view

When not to use

  • The message requires an immediate decision. Use alert-dialog.
  • The notice is a single inline status. Use alert.

Installation

Add the Haze registry to components.json once, then install Notification stack with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/notification-stack
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
id*string–Unique prefix for the component and its labelled controls.
labelstring"Notifications"Heading for the updates list.
itemsNotification[]–Items with title, optional description, and optional info, success, warning, or destructive variant.
emptyLabelstring"You’re caught up."Message after all items are dismissed.
dismissLabelstring"Dismiss"Accessible prefix for the dismiss button.
headingLevel2 | 3 | 4 | 5 | 62Heading level for the title.
stackedbooleanfalseLayer three peeking cards. Hover, focus or the expand button fans them out. Touch can swipe right to dismiss.
classstring–Additional classes on the section.
hazeNotice.promise(task, options)script API on the section element–Adds a pending row at the top with a spinner and the loading text, then morphs the same row to success or error when the promise settles: the icon pops in, the text swaps and the height eases over 200 ms. Options: loading, success and error (a string, a { title, description } object, or for success and error a function of the result), and duration in ms before a settled row leaves (default 4000, paused while hovered or focused). Returns the original promise.

Keyboard interactions

Tab then Enter or Space
Focus and dismiss an update.

Accessibility

  • Each button includes the notification title in its accessible name.
  • A promise row announces its loading text and then its result through the polite status line; the spinner and result icons are decorative. Settled rows dismiss themselves after the duration unless hovered or focused. Under reduced motion the spinner is static and the height change is instant.
  • Dismissal moves focus to a remaining dismiss button or to the section heading.
  • The persistent list is readable with scripts off. Dismissal applies to the current page view.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI component "Notification stack" with `npx shadcn@latest add @haze/notification-stack`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import NotificationStack from "@/components/haze/ui/notification-stack.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/ui/notification-stack.md

  • Customize with real content

    Adapt the Haze notification-stack ui for our product. Replace the demo values of these props with our real content: id, label, items, emptyLabel, dismissLabel, headingLevel, stacked, class, hazeNotice.promise(task, options). Keep the layout, the heading level rules and these accessibility details: Each button includes the notification title in its accessible name. A promise row announces its loading text and then its result through the polite status line; the spinner and result icons are decorative. Settled rows dismiss themselves after the duration unless hovered or focused. Under reduced motion the spinner is static and the height change is instant. Dismissal moves focus to a remaining dismiss button or to the section heading. The persistent list is readable with scripts off. Dismissal applies to the current page view. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using notification-stack, check it fits: use it when a panel lists recent events people can read at their own pace; each event can be independently dismissed for the current view. Avoid it when the message requires an immediate decision. use alert-dialog.; the notice is a single inline status. use alert.. Alternatives: @haze/alert, @haze/alert-dialog, @haze/empty.

Dependencies

  • npm: @lucide/astro
  • @haze/button
  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog