Ballmac UI home

Notification Stack

macOS Notification Center cards: collapsed, the newest sits in front with two peeking behind; click or press Enter to spring the stack open. New cards slide in from the top; each can be dismissed.

  • Maya

    now
    The new icons look great on the dark wallpaper. Ship it!

Installation

$ pnpm dlx shadcn@latest add @ballmac/notification-stack

Usage

import { Notification, NotificationStack } from "@/components/ballmac/notification-stack"

The full example is in the Code tab above.

API reference

<NotificationStack>

PropTypeDefault
children

Notification elements, newest first. Give each a stable `key`; new keys animate in from the top.

React.ReactNode—
expanded

Controlled expanded state.

boolean—
defaultExpanded

Initial expanded state when uncontrolled.

booleanfalse
onExpandedChange

Called when the stack expands or collapses.

(expanded: boolean) => void—
onClearAll

Shows a "clear all" button when set.

() => void—
label

Heading shown above the expanded list; also the region's accessible name.

string—

<Notification>

PropTypeDefault
icon

App icon, drawn in a 36px rounded tile. Style the tile with iconClassName.

React.ReactNode—
iconClassName

Classes for the icon tile (background gradient, color).

string—
title*

Bold first line.

React.ReactNode—
time

Short relative time, e.g. "now" or "9m ago".

React.ReactNode—
onDismiss

Shows a dismiss button (on hover and focus) that calls this.

() => void—
dismissLabel

Accessible label of the dismiss button.

string—

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
TabFocuses the stack's expand button when collapsed, or each card's dismiss button and Show less when expanded
Enter / SpaceExpands the collapsed stack (focus moves to Show less) or activates the focused button
EscapeCollapses an expanded stack and returns focus to it

Use with AI

Render <NotificationStack> with <Notification key icon iconClassName title time onDismiss>body</Notification> children, newest first. Keep items in state; prepend to add (animates in), filter to dismiss. expanded/defaultExpanded/onExpandedChange control the stack; onClearAll adds a clear button. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Notification Stack (@ballmac/notification-stack) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • An activity or notification feed in a dashboard corner
  • A landing-page hero showing the alerts a product sends (deploys, reviews, payments)
  • Grouping several recent events so they take the space of one

Not for

  • Transient feedback after a single action (use a toast)
  • A single live activity that changes over time (use dynamic-island)

Registry JSON: https://ui.ballmac.com/r/notification-stack.json

Credits

Free to use in personal and commercial projects.