docs / core / notification-badge
NotificationBadge
a small count or dot pinned to the corner of whatever it wraps: an icon, a button, an avatar. it vanishes at zero, so silence stays silent.
intensity · recedesrsc · server
provenance
shaped from sisu-pluslayer
core / primitivesintensity
recedes · safe anywhere, including dense surfacescomposition
wraps an icon-only Button, an avatar, a nav itemdot mode for presence, count mode for unreadnot a status Badge. it counts, it does not labelnever on a bare icon with no accessible name of its owna11y
the dot isaria-hidden · the wrapper never steals the child's role or namejest-axelive demo · try it out
3
customize
countthe number shown
maxcap before N+
dotbare presence dot, no number
toneindicator colour
showZerostay visible at 0
usage
import { Button } from "@usva-ui/react/primitives/button";
import { NotificationBadge } from "@usva-ui/react/primitives/notification-badge";
<NotificationBadge count={3}>
<Button variant="outline" iconOnly aria-label="Notifications">
<BellIcon />
</Button>
</NotificationBadge>props
| prop | type | default | notes |
|---|---|---|---|
| count | number | 0 | the count to show. hidden at 0 unless showZero. |
| max | number | 9 | cap before showing "N+". |
| dot | boolean | false | a bare presence dot instead of a number. |
| tone | "accent" | "accent-alt" | "danger" | "warning" | "danger" | indicator color. |
| showZero | boolean | false | keep the badge visible at 0. |
get it
bun add @usva-ui/reactusage
import { Button } from "@usva-ui/react/primitives/button";
import { NotificationBadge } from "@usva-ui/react/primitives/notification-badge";
<NotificationBadge count={42} max={9}>
<Button variant="outline" iconOnly aria-label="Notifications">
<BellIcon />
</Button>
</NotificationBadge>