Notification Center

The Notification Center component displays notifications with customizable behavior and polling capabilities.

Usage

Default

Notifications

  • You have a new follower.05:22 PM
  • Profile updated successfully.05:22 PM
  • Storage space running low.05:22 PM
  • Failed to load image.05:22 PM

<NotificationCenter
  notifications={mockNotifications}
  setNotifications={() => {}}
  onRemove={() => {}}
  onClearAll={() => {}}
/>

Props

Data table
TypeDescription
aria-describedbystringOptional ID of an element that describes the notification center.
aria-labelstringAccessible label for the notification center region.
aria-labelledbystringOptional ID of an external element that labels the notification center.
clearAllAriaLabelstringAccessible label for the clear all button.
clearOldOnOverflowbooleanIf true, clears the oldest notifications when over the maximum.
controlRoundingRoundingTypeRounding for the notification control. One of: "none" | "small" | "medium" | "large" | "full"
controlShadowShadowTypeShadow for the notification control. One of: "none" | "light" | "medium" | "strong" | "intense"
data-testidstringOptional test ID for testing frameworks.
dismissButtonLabelPrefixstringPrefix used to build dismiss button labels.
emptyMessagestringAccessible text announced when there are no notifications.
fetchNotifications(() => Promise<Notification[]>)Optional callback function to fetch more notifications.
list-aria-labelstringAccessible label for the notifications list when needed.
liveRegionAtomicbooleanWhether the live region should announce the entire region or only changed content.
liveRegionPoliteness"off" | "polite" | "assertive"Live region politeness level for notification updates.
liveRegionRelevant"text" | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals"Which kinds of changes should be announced by assistive technology.
maxNotificationsnumberMaximum number of notifications to display.
notificationRoundingRoundingTypeRounding of the notification. One of: "none" | "small" | "medium" | "large" | "full"
notificationsNotification[]Array of notifications to display.
notificationShadowShadowTypeShadow of the notification. One of: "none" | "light" | "medium" | "strong" | "intense"
onClearAll(() => void)Optional callback function to clear all notifications.
onRemove(id: string) => voidCallback function to remove a notification by its ID.
pollIntervalnumberOptional interval (in milliseconds) at which to fetch more notifications.
setNotificationsReact.Dispatch<React.SetStateAction<Notification[]>>Callback function to set the notifications array.
showClearAllbooleanWhether to show a "Clear All" button if notifications are present.