Display
Badge
Small count and status indicators anchored to icons, avatars and buttons.
<script>
import { Badge, IconButton } from "@codeatlasdev/ui";
</script>
<Badge count={3}><IconButton aria-label="Messages">…</IconButton></Badge>
Badge wraps its child and positions the indicator on the corner. Pass count for a number (hidden at 0, capped at 99+) or dot for a plain status dot. The indicator is a role="status" element labelled “New” (dot) or “N notifications” (count) from the i18n catalog; still give the wrapped control its own accessible name.
Dot and counts
`dot` shows a plain indicator, `count` shows a number capped at `99+`.
3 99 99+
Reference #113 · Pick in the gallery
Code
On avatars
Status dots on avatars.
AL CM DK
Reference #114 · Pick in the gallery
Code
Colors
brand, success, warning and error.
5 5 5 5
Reference #112 · Pick in the gallery
Code
Props
| Prop | Type | Default | Description |
|---|---|---|---|
count | number | undefined | Number to display. Hidden when 0 or undefined unless `dot` is set. Values above 99 render as `99+`. |
dot | boolean | false | Shows a dot instead of a number. |
color | 'brand' | 'success' | 'error' | 'warning' | 'brand' | Indicator color. |
class | string | '' | Extra class names. |
children | Snippet | undefined | The element the badge is anchored to. |