Notification Badge
A dot or count pinned to the corner of another element, such as an icon button, to show there is something new.
Dot
Wrap the element you want to mark. Without content, the badge is a dot. size sets the dot to 6, 8 or 10px.
The badge is visual only and is not announced. Put the same information in the anchor's accessible name, for example aria-label="Notifications, 3 unread".
Content
content shows a short count or label inside the badge, which grows to fit it. Keep it to a few characters, like 99+ or Dev.
Placement
placement pins the badge to one of the four corners. It sits slightly outside the corner, with a ring in the page background color that separates it from the anchor.
Show and hide
show hides the badge without changing the layout of the anchor. Use it rather than conditionally rendering the wrapper.
Properties
The element the badge is pinned to
Short text or number inside the badge. The badge is a dot when omitted
Whether the badge is visible
Default: true
Corner of the anchor the badge is pinned to
Default: top-right
Badge color
Default: red
Size of the dot or badge
Default: md
Additional CSS classes for the wrapper around the anchor
Additional CSS classes for the badge, for example to nudge its position