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-expanded
attribute on the notification badge, - apply visual styling on the notification badge, and
- to indiciate 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.
Props
NotificationBadge
Name | Type | Default | Description |
---|---|---|---|
aria-label | string | Adds an accessible label to the notification badge. | |
attentionIcon | React.ReactNode | <AttentionBellIcon /> | Icon to display for attention variant. |
children | React.ReactNode | Content rendered inside the notification badge. | |
className | string | Additional classes added to the notification badge. | |
count | number | 0 | A number displayed in the badge alongside the icon. |
icon | React.ReactNode | <BellIcon /> | Icon to display in the notification badge. |
isExpanded | boolean | false | Flag for applying expanded styling and setting the aria-expanded attribute on the notification badge. |
variant | NotificationBadgeVariant | 'read' | 'unread' | 'attention' | NotificationBadgeVariant.read | Determines the variant of the notification badge. |
CSS variables
Expand or collapse column | Selector | Variable | Value |
---|