# Notification Stack URL: /docs/web/components/notification-stack A stacked notification card system with swipe-to-dismiss gestures, auto-pagination, action buttons, and animated transitions. **Demo:** ```tsx 'use client'; import { useCallback, useState } from 'react'; import { type NotificationItem, NotificationStack } from '@docyrus/ui/components/notification-stack'; import { ArrowRight, ArrowUpRight, Check, Info, MessageSquare, Receipt, Rocket, X } from 'lucide-react'; function createNotifications(startId: number): NotificationItem[] { return [ { id: `${startId}`, type: 'comment', variant: 'unread', icon: 'OA', badge: , title: ( <> Oguz Aksu commented on Project Alpha > ), content: (
No notifications
} /> ``` ## Variants | Variant | Description | |---------|-------------| | `default` | Standard notification cards. | | `bordered` | Cards with enhanced shadow (`shadow-md`). | ## Sizes | Size | Description | |------|-------------| | `sm` | Compact padding and smaller text. | | `default` | Standard sizing. | | `lg` | Larger padding and text. | ## Components | Component | Description | |-----------|-------------| | `NotificationStack` | Main container. Manages stacking, pagination, and dismissed state. | | `NotificationStackCard` | Individual notification card with swipe-to-dismiss gesture. | ## API Reference ### NotificationStack | Prop | Type | Default | Description | |------|------|---------|-------------| | `notifications` | `NotificationItem[]` | — | Array of notification items to display. | | `maxVisible` | `number` | `10` | Maximum number of visible cards before pagination. | | `loadMoreThreshold` | `number` | `2` | When remaining count reaches this threshold, `onLoadMore` is triggered. | | `onLoadMore` | `() => void` | — | Called when more notifications should be fetched. | | `onDismiss` | `(id: string) => void` | — | Called when a notification is swiped away. | | `onClick` | `(id: string) => void` | — | Called when a notification card is clicked. | | `onAction` | `(id: string, action: string) => void` | — | Called when an action button is clicked. | | `variant` | `'default' \| 'bordered'` | `'default'` | Visual style. | | `size` | `'sm' \| 'default' \| 'lg'` | `'default'` | Card sizing. | | `emptyState` | `ReactNode` | — | Content shown when no notifications exist. | | `className` | `string` | — | Additional CSS classes. | ## Type Reference ### NotificationItem | Field | Type | Description | |-------|------|-------------| | `id` | `string` | Unique identifier. | | `type` | `'default' \| 'success' \| 'warning' \| 'error' \| 'info'` | Notification type (determines icon and color). | | `title` | `string` | Notification title. | | `message` | `string` | Notification body text. | | `icon` | `ReactNode \| string` | Custom icon override. | | `badge` | `ReactNode` | Badge content displayed alongside the notification. | | `actions` | `Array<{ label: string; onClick?: () => void }>` | Action buttons displayed at the bottom. | | `variant` | `'default' \| 'unread' \| 'highlighted'` | Visual variant for the individual card. | ### Interaction Details - **Swipe to dismiss**: Drag horizontally past 100px or at 500px/s velocity. - **Stacking**: Cards stack with scale reduction (5% per level) and vertical offset (10px per level). - **Pointer events**: Only the top card is interactive; stacked cards below are visual-only. - **Auto-dismiss on action**: Cards are dismissed after an action button click.