tinkerers-labs

Notification Stack

Component

About

Several notifications kept as one compact stack. It spreads into a readable list on hover, focus or tap, and folds back when you leave.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Notification Stack to your project and fits it to your theme.

Code

How Notification Stack is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client"

import * as React from "react"
import {
  CalendarClock,
  GitBranch,
  HardDrive,
  MessageSquare,
} from "lucide-react"

import {
  NotificationStack,
  type NotificationStackItem,
} from "@/components/ui/mischief-notification-stack"

const initial: NotificationStackItem[] = [
  {
    id: "comment",
    title: "New comment on Launch checklist",
    description: "Can we move the beta date to Thursday?",
    time: "2m ago",
    icon: <MessageSquare size={16} />,
  },
  {
    id: "build",
    title: "Build passed on main",
    description: "All 3 checks finished in 4 minutes.",
    time: "9m ago",
    icon: <GitBranch size={16} />,
  },
  {
    id: "meeting",
    title: "Design review starts in 15 minutes",
    description: "Room 4 and the video link are in the invite.",
    time: "12m ago",
    icon: <CalendarClock size={16} />,
  },
  {
    id: "storage",
    title: "Storage is almost full",
    description: "9.2 GB of 10 GB used. Old exports can be removed.",
    time: "1h ago",
    icon: <HardDrive size={16} />,
  },
]

const later: NotificationStackItem = {
  id: "reply",
  title: "Reply on Launch checklist",
  description: "Thursday works. I will update the plan.",
  time: "Just now",
  icon: <MessageSquare size={16} />,
}

const action =
  "border-border hover:bg-muted focus-visible:ring-ring/50 min-h-9 rounded-[var(--radius)] border px-3 text-sm outline-none focus-visible:ring-4 disabled:opacity-50"

export default function NotificationStackDemo() {
  const [items, setItems] = React.useState(initial)
  const replied = items.some((item) => item.id === later.id)

  return (
    <div className="flex w-full max-w-sm flex-col gap-4">
      <NotificationStack
        items={items}
        onDismiss={(id) =>
          setItems((list) => list.filter((item) => item.id !== id))
        }
        onClearAll={() => setItems([])}
      />
      <div className="flex flex-wrap gap-2 pt-8">
        <button
          type="button"
          className={action}
          disabled={replied}
          onClick={() => setItems((list) => [later, ...list])}
        >
          Get a reply
        </button>
        <button
          type="button"
          className={action}
          onClick={() => setItems(initial)}
        >
          Reset
        </button>
      </div>
    </div>
  )
}

Dependencies

More by tinkerers-labs

View all
  • Prompt Input

    Prompt Input

    11
  • Burst

    Burst

    4
  • Undo Button

    Undo Button

  • Tool Approval

    Tool Approval

  • Swipe Actions

    Swipe Actions

  • Sparkline

    Sparkline

  • Ghost Text

    Ghost Text

  • Slash Menu

    Slash Menu