Notification Stack

Notification Stack: Compact notification cards that spring from a stacked summary into a readable list on hover, focus or tap. Free MIT React & Next.js source with Motion and Tailwind CSS, live preview, CLI install and docs.

Install Notification Stack

npx motion-ui-skill add notification-stack

Components install as source into your project. The interactive page also includes preview, code, documentation and install tabs.

Dependencies

  • clsx
  • lucide-react
  • motion
  • react
  • tailwind-merge

Source files

Notification Stack

Compact notification cards that spring from a stacked summary into a readable list on hover, focus or tap.

Install

npx motion-ui-skill add notification-stack

Dependencies

  • clsx
  • lucide-react
  • motion
  • react
  • tailwind-merge

Usage

"use client";

import { RotateCw } from "lucide-react";
import {
  NotificationStack,
  type NotificationStackItem,
} from "@/components/motion/notification-stack";

const notifications: NotificationStackItem[] = [
  {
    id: "import-failed",
    title: "Orders import failed",
    description: "42s · TimeoutError at Step 2",
    trailing: (
      <span className="inline-flex items-center gap-1 text-amber-500 dark:text-amber-400">
        <RotateCw className="h-3.5 w-3.5" aria-hidden="true" />
        2
      </span>
    ),
  },
  {
    id: "sla-breach",
    title: "SLA breach",
    description: "2m 11s · Data enrichment",
  },
  {
    id: "sync-fixed",
    title: "Product sync auto-fixed",
    description: "5m · 404 on GET /products",
  },
];

export function NotificationStackPreview() {
  return (
    <div className="flex w-full items-center justify-center pt-52 pb-6">
      <NotificationStack items={notifications} />
    </div>
  );
}

API Reference

NotificationStack

Prop Type Default Required Description
items NotificationStackItem[] — Yes —
expanded boolean — No —
defaultExpanded boolean false No —
onExpandedChange ((expanded: boolean) => void) — No —
onViewAll (() => void) — No —
maxVisible number 3 No —
collapsedLabel string Notifications No —
expandedLabel string View all No —
emptyLabel string All caught up No —
className string — No —
classNames NotificationStackClassNames — No —

Browse this category