Badge
Badges show notifications, counts, or status information on navigation items and icons.
Props
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
label | string | number | No | — | Text shown inside the badge. Omitted, the badge renders as the small dot Material 3 uses for an unread notification. Material limits badge content to four characters including a `+`; use `max` to keep a count within that. |
max | number | No | — | Caps a numeric `label`. A label of 100 with `max` 99 renders `99+`. Ignored when `label` is not a number. |
description | string | No | — | What assistive technology announces for the badge, such as `3 unread messages`. The visible label is rarely enough on its own -- `3` says nothing about what there are three of -- and the small dot has no text at all, so this is the only way it reaches a screen reader. |
visible | boolean | No | true | Whether the badge is shown. Default: `true`. Set it to `false` rather than unmounting the badge, so it can animate out; it stays in the DOM, invisible and hidden from assistive technology, until it is shown again. Material recommends clearing a badge once its destination has been viewed. |
transition | BadgeTransition | No | — | Anime.js show-hide timing. |
className | string | Partial<Record<"container" | "label" | "badge" | "announcement", string>> | ClassNameComponent<BadgeInterface> | No | — | Root classes (string), static element classes (object), or state-aware element classes (function). |
children | ReactNode | No | — | The icon or item the badge is anchored to. |