Default notification
A general notification without specific type
Just now
Persistent notification items for notification centers, inboxes, and activity feeds. Unlike Toast (ephemeral), these remain visible until dismissed.
Interactive notification center with dismiss and read actions
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
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
Notifications with avatars and action buttons
Sarah commented on your post
Great work! I really like the new design approach.
5 min ago
Mike started following you
You have a new follower
1 hour ago
Team invitation
John invited you to join the Design team
10 min ago
Notification component API reference
| Prop | Type | Default | Description |
|---|---|---|---|
title* | string | — | Notification title |
description | string | — | Notification message body |
timestamp | string | — | Relative or absolute time string |
variant | 'default' | 'info' | 'success' | 'warning' | 'error' | 'default' | Semantic style variant |
read | boolean | false | Whether the notification has been read |
avatar | React.ReactNode | — | Avatar component to display |
icon | React.ReactNode | — | Custom icon (overrides variant icon) |
actions | React.ReactNode | — | Action buttons (Accept/Decline, etc.) |
onClick | () => void | — | Click handler for the notification |
onDismiss | () => void | — | Dismiss handler (shows X button) |
onAction | () => void | — | Action menu handler (shows ... button) |
| Prop | Type | Default | Description |
|---|---|---|---|
emptyMessage | string | 'No notifications' | Message when list is empty |
className | string | — | Additional CSS classes |
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>
)
}Built-in functionality
Accessibility considerations
role="feed" on NotificationList containerrole="article" on individual notificationsaria-label on dismiss and action buttons| Key | Action |
|---|---|
| Tab | Navigate between notifications and buttons |
| Enter / Space | Activate notification or button |