Badge
A small count or dot on a control that says how many things are on, new, or waiting: "Filters" with "1", a navigation icon with "4", a dot for something that needs attention.
When to use
- A count after a control's label: how many filters are on ("Filters" with "1") (D-CSN-33).
- A count on a navigation icon: how many items wait (icon badge).
- Something new or needing attention without a number, on an icon (dot).
When not to use
| Situation | Use instead |
|---|---|
| A status of a record ("Active", "Invited") | Status chip |
| A person type or a category | Status chip in the cat-* tones |
| A live state ("Live now", "Ready to scan") | Status indicator with its word |
| A label like "New" or "Beta" | A status chip with the word, or nothing |
| A number that is the content itself (a KPI, a score) | Stat tile, numeral-* styles |
| Decoration | Nothing: a badge always means something |
Anatomy
- Count badge
.oa-badge: a pill holding the number, after the control's label. - Icon badge
.oa-badge--icon: a 16px pill on the icon's top inline-end corner. - Dot
.oa-badge--dot: a 6px dot on the icon's top inline-end corner. - The words (in the host): the count or the meaning in the control's accessible name; the badge itself is
aria-hidden.
Variants
| Variant | Class | Use for | Key tokens |
|---|---|---|---|
| Count | oa-badge |
After a label: filters on, items selected | --color-primary, --color-on-primary, --text-label-sm |
| Icon badge | oa-badge oa-badge--icon |
A count on a navigation or icon-button icon | as count, 16px |
| Dot | oa-badge oa-badge--dot |
Attention without a number | --color-primary-ink, 6px |
The count and the icon badge are fills: primary with on-primary (6.19:1; 5.70:1 under the Tamakkan accent). The dot has no words inside, so it must reach 3:1 against its ground on its own: it is primary-ink (5.45:1 or more), because primary is 2.63:1 on the page (canonical §2.2, §2.13).
Sizes
| Size | Height | Padding | Type style | Icon size |
|---|---|---|---|---|
| Count | 24px, at least 24px wide | inline 6px (--space-1-5) |
label-sm 12/16 500, tabular figures |
— |
| Icon badge | 16px, at least 16px wide | inline 4px (--space-1) |
label-sm, tabular figures |
on a 24px icon |
| Dot | 6px | — | — | on a 24px icon |
The count sits 8px after its label: the host's gap (buttons and chips are 8px-gap rows). Above 99 it reads "99+" (canonical §10.26). The 24, 16, and 6px sizes are component constants, not tokens (D-ARC-04, D-ARC-24).
Tokens
| Part | Property | Token |
|---|---|---|
| Count, icon badge | fill, text | --color-primary, --color-on-primary |
| Count, icon badge | type | --text-label-sm with its companions; font-variant-numeric: tabular-nums |
| Count, icon badge | corner | --radius-full |
| Count | padding | --space-1-5 |
| Icon badge | padding, offset | --space-1; placed from the icon's corner with --size-icon-lg, --space-1, --space-0-5 |
| Dot | fill | --color-primary-ink |
| All | edge | 1px transparent (3px on the dot), so forced colors draw the shape |
States
| State | What changes |
|---|---|
| Shown | The count is above zero, or the attention exists. |
| Hidden | Zero, or nothing new: remove the badge (and its words from the name); never show "0". |
| Changed | The number updates in place; the host's accessible name updates with it. A count that changes while the person waits is announced by the page's status region, not by the badge. |
The badge is not interactive: its host (a button, a navigation item) has the states.
Behavior
- The count follows the host's label at 8px; it never wraps away from it.
- Icon badges and dots sit on the top inline-end corner of a 24px icon centered in a positioned host (an icon button, a navigation indicator); they never cover the icon's middle.
- Above 99, "99+"; Western digits in every language (canonical §14.3).
- Nothing pulses or animates.
Accessibility
- Name. The count is part of the control's accessible name: "Filters, 1 filter on", "Photos waiting: 4", "Security: one thing needs your attention". The badge is
aria-hidden; the words sit in the host (aria-label, or a visually hidden span after the label) (D-CSN-33). - Not by color alone. The dot's meaning is in the name; the dot is the second cue.
- Contrast.
on-primaryonprimary6.19:1 (light and dark), 5.70:1 under the Tamakkan accent; the dotprimary-ink5.45:1 or more on every surface. - Text size.
label-sm, 12px: the smallest text that may carry meaning. - Forced colors. The transparent border keeps the pill's outline; the dot's 3px border draws it filled.
RTL and languages
- Icon badges and dots sit on the inline-end corner: the top left in Arabic.
- Numbers stay Western digits; "99+" stays left to right.
- The words in the name are translated: "تصفية" with a hidden "، عامل تصفية واحد مفعّل" (native review); French "Filtres, 1 filtre actif" (native review).
Content
- The number only, no words inside the badge: "1", "12", "99+".
- The words in the name say what the number counts, with ICU plurals: "{count, plural, one {# filter on} other {# filters on}}".
- A dot's words say what needs attention: "One thing needs your attention" (Global ID's security status).
Do and don't
| Do | Don't |
|---|---|
| Put the count in the control's name ("Filters, 1 filter on"). | Leave a screen reader with "Filters 1". |
Use primary with on-primary for counts. |
Use Material's default error red for counts, or 13px text (Jobs' badge today). |
Use primary-ink for a dot that means something. |
Use a 2.63:1 primary dot as the only cue. |
| Remove the badge at zero. | Show "0" or an empty pill. |
| Write "99+" above 99. | Let the pill grow with long numbers. |
Code
HTML (reference CSS)
A count after a label:
<button class="oa-btn oa-btn--outlined" type="button"><span class="oa-icon oa-btn__icon" aria-hidden="true" translate="no">tune</span><span class="oa-btn__label">Filters</span><span class="oa-badge" aria-hidden="true">1</span><span class="oa-visually-hidden">, 1 filter on</span></button>Counts:
<span class="oa-badge" aria-hidden="true">1</span>
<span class="oa-badge" aria-hidden="true">12</span>
<span class="oa-badge" aria-hidden="true">99+</span>Icon badge and dot on icon buttons:
<button class="oa-icon-btn" type="button" aria-label="Photos waiting: 4"><span class="oa-icon" aria-hidden="true" translate="no">photo_camera</span><span class="oa-badge oa-badge--icon" aria-hidden="true">4</span></button>
<button class="oa-icon-btn" type="button" aria-label="Security: one thing needs your attention"><span class="oa-icon" aria-hidden="true" translate="no">verified_user</span><span class="oa-badge oa-badge--dot" aria-hidden="true"></span></button>Arabic:
<button class="oa-btn oa-btn--outlined" type="button"><span class="oa-icon oa-btn__icon" aria-hidden="true" translate="no">tune</span><span class="oa-btn__label">تصفية</span><span class="oa-badge" aria-hidden="true">1</span><span class="oa-visually-hidden">، عامل تصفية واحد مفعّل</span></button>Tailwind CSS v4
<!-- Count badge, inside a button with gap-2 -->
<span aria-hidden="true" class="inline-flex h-6 min-w-6 shrink-0 items-center justify-center rounded-full border border-transparent bg-primary px-1.5 text-label-sm tabular-nums text-on-primary">1</span>
<!-- Icon badge on a 48px icon button (relative): -->
<span aria-hidden="true" class="pointer-events-none absolute top-[calc(50%-16px)] start-[calc(50%+2px)] inline-flex h-4 min-w-4 items-center justify-center rounded-full border border-transparent bg-primary px-1 text-label-sm tabular-nums text-on-primary">4</span>
<!-- Dot on a 48px icon button (relative): -->
<span aria-hidden="true" class="pointer-events-none absolute top-[calc(50%-12px)] start-[calc(50%+6px)] size-1.5 rounded-full border-3 border-transparent bg-primary-ink"></span>React
| Prop | Type | Default | Description |
|---|---|---|---|
count |
number |
— | Renders "99+" above max; nothing at 0. |
max |
number |
99 |
The largest number shown. |
variant |
"count" | "icon" | "dot" |
"count" |
icon and dot sit on the host's icon. |
(host) label |
string |
— | The host's accessible name, with the count in words. |
<Button variant="outlined" icon="tune">
{t('filters')}
{active > 0 ? <><Badge count={active} /><VisuallyHidden>{t('filtersOn', { count: active })}</VisuallyHidden></> : null}
</Button>
<IconButton icon="photo_camera" label={t('photosWaiting', { count })}><Badge variant="icon" count={count} /></IconButton>shadcn/ui: its Badge is a chip; use this badge for counts (D-CSN-33).