Examples
Basic
The following example demonstrates the three variants of notification badge that are available: “read”, “unread”, and “attention”.
The isExpanded property is also passed in to:
- set the
aria-expandedattribute on the notification badge, - apply visual styling on the notification badge, and
- to indicate that a notification drawer is expanded, for use-cases as seen in our notification drawer react demos.
With count
You can display a number within the notification badge by passing in the count property, to indicate how many read, unread, or attention notifications there are. The isExpanded property is also passed in, similar to the notification badge basic example.
With animation
To animate the icon within the notification badge, use the shouldNotify property. In this example, the notification badge icon will only animate if the notification count is greater than 0.