Notification

Feedback
Data Display

Persistent notification items for notification centers, inboxes, and activity feeds. Unlike Toast (ephemeral), these remain visible until dismissed.

Preview

Interactive notification center with dismiss and read actions

Notifications

2 unread

New message from Sarah

Hey, just wanted to follow up on our meeting...

2 min ago

Payment received

$250.00 has been added to your account

1 hour ago

Server alert

CPU usage exceeded 90% threshold

3 hours ago

Variants

Five semantic variants for different notification types

Default notification

A general notification without specific type

Just now

Information

Your profile has been viewed 42 times this week

5 min ago

Success

Your changes have been saved successfully

10 min ago

Warning

Your subscription expires in 3 days

1 hour ago

Error

Failed to sync your data. Please try again.

2 hours ago

Rich Content

Notifications with avatars and action buttons

With Avatar

SC

Sarah commented on your post

Great work! I really like the new design approach.

5 min ago

MK

Mike started following you

You have a new follower

1 hour ago

With Actions

JD

Team invitation

John invited you to join the Design team

10 min ago

Props

Notification component API reference

PropTypeDefaultDescription
title*stringNotification title
descriptionstringNotification message body
timestampstringRelative or absolute time string
variant'default' | 'info' | 'success' | 'warning' | 'error''default'Semantic style variant
readbooleanfalseWhether the notification has been read
avatarReact.ReactNodeAvatar component to display
iconReact.ReactNodeCustom icon (overrides variant icon)
actionsReact.ReactNodeAction buttons (Accept/Decline, etc.)
onClick() => voidClick handler for the notification
onDismiss() => voidDismiss handler (shows X button)
onAction() => voidAction menu handler (shows ... button)

NotificationList Props

PropTypeDefaultDescription
emptyMessagestring'No notifications'Message when list is empty
classNamestringAdditional CSS classes

Usage

Import and implementation example

import { Notification, NotificationList } from '@/components/ui/notification'

export default function NotificationCenter() {
  const [notifications, setNotifications] = useState([
    { id: 1, title: 'New message', description: 'You have a new message', timestamp: '2 min ago', read: false },
    { id: 2, title: 'Update complete', description: 'Your profile has been updated', timestamp: '1 hour ago', read: true },
  ])

  const dismiss = (id: number) => {
    setNotifications(prev => prev.filter(n => n.id !== id))
  }

  const markAsRead = (id: number) => {
    setNotifications(prev => prev.map(n =>
      n.id === id ? { ...n, read: true } : n
    ))
  }

  return (
    <NotificationList emptyMessage="You're all caught up!">
      {notifications.map(n => (
        <Notification
          key={n.id}
          title={n.title}
          description={n.description}
          timestamp={n.timestamp}
          read={n.read}
          onClick={() => markAsRead(n.id)}
          onDismiss={() => dismiss(n.id)}
        />
      ))}
    </NotificationList>
  )
}

Features

Built-in functionality

  • Five variants: Default, info, success, warning, and error with semantic colors
  • Read/unread state: Visual indicator with blue dot for unread
  • Avatar support: Display user avatars for social notifications
  • Action buttons: Inline accept/decline or custom actions
  • Dismissible: Optional close button with callback
  • Empty state: NotificationList shows message when no items
  • Dark mode: Full dark mode support

Accessibility

Accessibility considerations

ARIA Attributes

role="feed" on NotificationList containerrole="article" on individual notificationsaria-label on dismiss and action buttons

Keyboard Navigation

KeyAction
TabNavigate between notifications and buttons
Enter / SpaceActivate notification or button

Notes

  • Unread indicator includes screen reader text
  • Timestamps provide context for notification age
  • Semantic variants use icons in addition to color

Related Components