Badge
Names a state, a kind or a count beside the thing it describes: seven colors in three sizes, a pill, with a dot or an icon. It is read, never pressed.
<Badge color="success" dot>Active</Badge><Badge color="info">Preview</Badge><Badge color="error" emphasis="high" size="md" className="tabular-nums">9+</Badge>Installation
import { Badge } from "@catalog-dashboard/components";Usage
<Badge color="success" dot>Active</Badge>Anatomy
- 1 · Fill. A pale shade of the color, or a strong one at high emphasis. Both are solid: nothing shows through (neutral alone is see-through, so gray still shows on gray). No ring and no border: an edge is what a control has.
- 2 · Left slot. A start icon; the status dot is one of them. Its side is a pixel or two tighter than the text's, so it sits as far from the end as the text does.
- 3 · Label. A word or two in the color's text, medium weight, or a count.
- 4 · Right slot. An end icon, in the text's color.
| Size | Height | Text | Icon | Pill's side | Icon to text |
|---|---|---|---|---|---|
lg | 24px | label-3, 12px | 12px | 10px | 4px |
md | 20px | label-4, 11px | 10px | 8px | 4px |
sm | 16px | label-5, 10px | 10px | 6px | 3px |
Sizes
Three sizes, and no more: lg is 24px tall with 12px text, the default; md 20px with 11px text (the sidebar, a card title's count, a menu row, a table's +N); sm 16px with 10px text (beside a 12px label, and by a page's title). They are a badge's large, medium and small, not a button's: nothing is taller than 24px, too big for a badge.
<Badge color="success" size="lg">Active</Badge><Badge color="success" size="md">Active</Badge><Badge color="success" size="sm">Active</Badge>Colors
Seven, by meaning: neutral (the default) for what has no judgment in it, primary, the product's purple, for what is Dome's own or new rather than a status, success, warning, error and info for a status, and fuchsia, an identity color rather than a status (model pools). One hue each: the fill, the dot and the text come from one ramp. In dark the purple fill is a step darker than the blue one, so New and Preview differ by lightness, not only by hue.
<Badge color="neutral">Draft</Badge><Badge color="primary">New</Badge><Badge color="success">Active</Badge><Badge color="warning">Stale</Badge><Badge color="error">Failed</Badge><Badge color="info">Preview</Badge><Badge color="fuchsia">Pool</Badge>Emphasis
low, the default, is the pale fill: every badge unless it says otherwise. high is a strong fill, for a number that must not be missed. A solid badge looks like a button, so think twice before giving it to anything but a count. Each color's solid fill is chosen by itself, color by color: none is worked out from the low badge.
<Badge color="error">Failed</Badge><Badge color="error" emphasis="high" size="md" className="tabular-nums">9+</Badge>Shape
full, the default, is a pill: badges are full rounded. rounded follows the buttons' corner radius and keeps their padding; it is the exception.
<Badge>Draft</Badge><Badge shape="rounded">Draft</Badge>Status dot
dot puts a Status dot in the start icon's place. It says a live state (running, connected, failing). The dot is 6px at every size, in the badge color's own dot shade, not the text's, and sits a pixel closer to its end than an icon. Given its own props (dot={{ color, size, halo, haloSize, pulse }}) it can take another color than its badge, another size, a halo, and pulse. A pulsing dot's halo is two stops darker than the badge's fill, so it shows on it. With a dot, iconStart is not drawn.
<Badge color="success" dot>Active</Badge><Badge color="warning" dot>Degraded</Badge><Badge color="error" dot>Unreachable</Badge>With an icon
iconStart says what kind of thing the badge names, or its state, where a dot would say too little. Every icon but the dot is drawn in the text's color, at the size the badge sets.
<Badge color="success" iconStart={CheckCircle}>Verified</Badge><Badge color="neutral" iconStart={Clock}>Scheduled</Badge><Badge color="fuchsia" iconStart={Layers}>Pool</Badge>A decision: Allow or Deny
decision makes the badge the Allow / Deny badge. It is allow or deny; nothing else exists. It sets the start icon (the filled circle check, the filled circle cross) and the color (green, red), so with it the badge takes no iconStart, dot or shape. The word stays the screen's: Allow and Deny on a rule's effect and a ruling's outcome, Allowed and Denied on an audit event's status. color="neutral" is the one other color, for a decision that is context and not the verdict (a ruling's deterministic result).
<Badge decision="allow">Allow</Badge><Badge decision="deny">Deny</Badge><Badge decision="allow">Allowed</Badge><Badge decision="deny">Denied</Badge><Badge decision="allow" color="neutral">Allow</Badge>A decision's circle and its padding
The circle sits nested in the pill's round end: as far from the left as from the top and bottom, 6px at lg, 5px at md, 3px at sm. The right side is set against it: 8px, 7px and 6px. The gap from the circle to the word is the pill's own: 4px, 4px and 3px. Only decision turns this on.
<Badge decision="allow">Allow</Badge><Badge decision="allow" size="md">Allow</Badge><Badge decision="allow" size="sm">Allow</Badge><Badge decision="deny">Deny</Badge><Badge decision="deny" size="md">Deny</Badge><Badge decision="deny" size="sm">Deny</Badge>Icon at the end
iconEnd follows the label: a trailing glyph, such as an info icon or a remove icon. The Badge only draws it: the glyph takes no click and opens nothing by itself.
<Badge color="warning" iconEnd={QuestionCircle}>Limited</Badge>Icon only
With no label the badge is as wide as it is tall. Name it for screen readers, since nothing else does.
<Badge color="success" iconStart={Check} aria-label="Verified" /><Badge color="success" size="md" iconStart={Check} aria-label="Verified" />Counts
A number in a badge. One character makes a circle, since a badge is never narrower than it is tall; longer counts grow by the padding. Give it tabular-nums, so it keeps its width as it changes. The Badge has no cap of its own: the assistant's count goes through its own helper (formatBadgeCount in lib/assistant-threads.ts), which shows nothing at zero and 9+ past nine.
<Badge color="error" emphasis="high" size="md" className="tabular-nums">3</Badge><Badge color="error" emphasis="high" size="md" className="tabular-nums">9+</Badge><Badge size="md" className="tabular-nums">12</Badge>Carried by other components
Three components take a badge from their caller and pick its size themselves. A button group's item and a menu row (DropdownMenuItem, DropdownMenuSubTrigger) take a badge: label, color, emphasis, iconStart, iconEnd and title. A menu row's badge is as tall as the row's line: 20px in a medium menu, 16px in a small one. CardTitle count takes a number, a string, or { value, color, emphasis, title }, always at 20px.
Two more draw a badge of their own: a Field's optional and the Table's +N.
<CardTitle count={12}>Agents</CardTitle><CardTitle count={{ value: 3, color: "error", emphasis: "high" }}>Denials</CardTitle> <ButtonGroup size="sm" aria-label="Issues"> <ButtonGroupItem badge={{ label: "4", color: "neutral" }}>Open</ButtonGroupItem> <ButtonGroupItem badge={{ label: "12", color: "neutral" }}>Closed</ButtonGroupItem></ButtonGroup> <DropdownMenuItem badge={{ label: "Preview", color: "info" }}>Guards</DropdownMenuItem><DropdownMenuItem badge={{ label: "3", color: "error", emphasis: "high" }}>Suggestions</DropdownMenuItem>The colors, measured
What each color is made of in light, from ds/tokens/badge.css. Neutral aside, a low fill is a solid: the color its recipe gives on the card, written out, so a badge is the same on a hovered row as on the card. Info is stops alone (fill 200, dot 800, text 1100). Primary and error are a stop mixed onto the card (purple 400 at 32%, red 700 at 28%) under a stop's text. Success, warning and fuchsia keep the designer's picks from before the ramps were respaced (400 at 28%, dot 600, text 1000), written out to the pixel: the table names the stop each now sits beside. Neutral is gray at 22% under the secondary text, and in dark its high fill inverts: a white fill under gray text. The ratio is the text against its fill, on a white card.
| Color | Low | High |
|---|---|---|
neutral | DraftGray 1300 at 22%, secondary text. Text 4.9 to 1. | DraftGray 1900. White 15.2 to 1. |
primary | NewPurple 400 at 32% on the card, text 1000. Text 6.8 to 1. | NewPurple 800. White 5.4 to 1. |
success | ActiveIts own, beside green 200; text beside 1100. Text 6.2 to 1. | ActiveIts own, beside green 900. White 3.9 to 1, picked. |
warning | StaleIts own, beside orange 200; text beside 1100. Text 6.7 to 1. | StaleIts own, beside orange 600. White 2.3 to 1, picked. |
error | FailedRed 700 at 28% on the card, text 1100. Text 6.1 to 1. | FailedRed 900. White 4.6 to 1. |
info | PreviewBlue 200, text 1100. Text 6.0 to 1. | PreviewBlue 900. White 4.1 to 1, picked. |
fuchsia | PoolIts own, beside fuchsia 200; text beside 1100. Text 7.2 to 1. | PoolIts own, beside fuchsia 1000. White 5.8 to 1. |
In the dashboard
What badges say in the dashboard today: about 213 of them in 113 files, in ten kinds. One card per kind, each a copy of a real use that names its file. The rules below come from these.
A status
Where something is in its life, or whether it is healthy: about 56 badges, most through StatusBadge. The commonest kind.
components/shared/status-badge.tsx
A decision
What a rule, a judge or a guard decided: allow or deny. The Badge's decision draws its circle and its color. About 15.
components/judges/outcome-badge.tsx
A resource's kind
Agent, gateway, tool, model or pool, each in a color of its own. They borrow the status colors: see the open question.
components/shared/resource-presentation.tsx
A type or a provider
What sort of thing a row is, with no judgment in it: neutral. With the resource kinds, about 49.
app/(authenticated)/[kind]/[scopeId]/triggers/page.tsx
A marker
One thing about an item: Default, Required, Recommended, Built-in. Neutral, often small. About 37.
components/shared/default-badge.tsx
A role or a scope
Who someone is here, or how far something reaches. Neutral, with color only for the roles that matter most. About 17.
components/settings/user-table.tsx
A Preview marker
A feature that is released but not generally available yet. One shared component, used in 21 places.
components/shared/preview-badge.tsx
A count
How many there are, beside a card's or a tab's title: neutral, small, tabular. About 23, none capped.
ds/components/card.tsx
A count that waits for you
The only high badges in the dashboard: the Dome Assistant's count in the sidebar and on its tabs, capped at 9+.
ds/components/sidebar.tsx
A label in a page header
What kind of thing the page is about, after its title: the smallest size, so it sits under the title's weight.
components/layout/detail-page-view.tsx
Accessibility
The ds Badge is a plain <span>: a screen reader reads its text where it stands, and nothing more. A color is never read, and an icon or a dot is hidden from the reader. The dashboard's own wrapper (components/ui/badge.tsx) can render another element through render, and carries a focus ring for that case.
A badge with an icon and no label has no text at all. How it gets a name is an open question below.
Every low badge's text clears 4.5 to 1 on its fill, in both themes, and a test holds them to it (ds/__tests__/badge-emphasis.test.ts). Three high fills fall under it, the designer's picks (success, warning and info): the table above has the numbers.
API Reference
Badge
Besides these, every prop of a <span> (title, aria-hidden, className…). Under the new design the dashboard's own components/ui/badge.tsx draws this look with the Badge's classes, not this component: the color is its color, or the one its variant maps to (every variant but link has one).
| Prop | Type | Default | Description |
|---|---|---|---|
decision | "allow" | "deny" | — | Makes it the Allow / Deny badge: the filled circle check or cross, nested in the pill's round end, in green or red. With it the badge takes no iconStart, dot or shape, and no color but "neutral". |
color | "neutral" | "primary" | "success" | "warning" | "error" | "info" | "fuchsia" | "neutral" | What the badge means. Fuchsia is an identity color, not a status. |
emphasis | "low" | "high" | "low" | Low is the pale fill. High is a strong fill, for a number that must not be missed; think twice before using it for anything else. |
size | "lg" | "md" | "sm" | "lg" | 24, 20 or 16px tall, with 12, 11 or 10px text. By a page's title the dashboard's badge is sm: the header sets it. |
shape | "full" | "rounded" | "full" | A pill, or the buttons' corners. A pill is 2px wider at each side, since its round ends take room. |
dot | boolean | { color?, size?, halo?, haloSize?, pulse? } | — | A Status dot in the left slot, in the icon's box. dot alone is the badge's own color with no halo; its props give it another color, a halo ("none" or "tint") or a pulse (its halo two stops darker than the badge's fill). With a dot, iconStart is not drawn. |
iconStart | IconComponent | — | A glyph in the left slot: a kind or a state, in the text's color. The SDS Dot passed here still draws the status dot, the way a badge asked for it before dot. |
iconEnd | IconComponent | — | A glyph after the label, in the text's color. |
tooltip | string | TooltipSettings | — | Shown on hovering the whole badge, and to the keyboard (the badge then takes Tab): the text, or the Tooltip's settings with its text. A cut word then shows no tooltip of its own. A table status with a reason uses it with the info icon as iconEnd. |
children | ReactNode | — | The label: a word or two, or a count. One character makes a circle. |
Rules
Open questions
Where does a count stop: 9+ or 99+?
OpenThe assistant's count shows 9+ past nine. The other counts, about twenty, show the raw number.
Atlassian caps a badge at 99 and shows 99+. Material caps at 999 and keeps a badge to four characters. Nobody caps at nine.
Where does the rounded shape go?
OpenBadges are pills, and no badge sets shape today. But over twenty ask for square-ish corners with a class (role badges, the counts inside the Gateways page's Review buttons), so the exception has no named place yet.
Polaris, Primer, Carbon and Material use one shape for everything.
Resource badges borrow the status colors
OpenA gateway's badge takes the warning color, a tool's the success green, a model's the info blue; agents and pools are fuchsia. So green means "healthy" in one column and "tool" in the next.
Atlassian: don't use accent colors when the label has a semantic meaning, and keep semantic colors for meaning. Carbon gives tags colors with no meaning at all (teal, purple, cyan) for categories.
A token you can remove
OpenThe rule builder's actions and a few lists are badges with a small remove button inside. badge.tsx names a remove icon as a use of iconEnd, but the Badge gives that icon no click.
Carbon has a dismissible tag for exactly this, apart from its read-only one. Polaris: for an interactive list of categories, use tags, not badges.
What does a long label do?
OpenIt never wraps and is never cut, so it pushes its row wider or runs out of its box. design/principles.md asks for a short label; nothing written says what a long one does.
Atlassian cuts a label at 200px, and notes that something that takes no focus cannot show what was cut.
A hover text on a badge inside a button or a menu row?
OpenA badge carried by a button group item or a menu row can take a title, which becomes the browser's own hover text: a mouse sees it, a keyboard and a touch screen never do.
Atlassian's tooltip page says never to use the title attribute.
How is a badge with no label named?
OpenThe icon-only example above puts an aria-label on the badge's span. A span has no role, so a screen reader may not read that label. Nothing written chooses how such a badge is named.
Polaris's badge takes hidden text that says what its tone and progress mean.
Emphasis
Low by default
Every badge is low unless it says otherwise. A page of badges should still read as text.
From ds/README.md (Badge) and ds/components/badge.tsx. Atlassian: use bold badges sparingly, and only when the element requires high visual prominence.
High is for a number
High emphasis is a solid fill, and a solid pill with a word in it looks like a button. Keep it for a count that must not be missed. If you want it for anything else, think twice, then a third time.
One high badge on a screen is a signal. Five are decoration.
From ds/README.md (Badge) and ds/components/badge.tsx. Apple, for the second paragraph: reserve badges for critical information so you don't dilute their impact and meaning.
Shape and size
A pill, unless there is a reason
Badges are full rounded: shape is full unless you set it. The rounded corners are the exception; where they go is an open question above.
Three sizes, picked by what's beside it
lg (24px) is the default; md (20px) in the sidebar, a card title's count, a menu row and a table's +N; sm (16px) beside a 12px label and by a page's title. Nothing in between, and nothing set with a height class.
From ds/README.md (Badge) and design/principles.md (the badges by a page's title).
The Badge spaces itself
A pill is 2px wider at each side than a rounded badge, an icon's side is 1px tighter than the text's, and a dot's 2px tighter, so each sits as far from its end as the text does. All of it is built in: never add padding, a gap or a margin inside a badge.
Color
One meaning, one color
Success, warning, error and info each say one thing about a state; neutral means no judgment; fuchsia is an identity color, for agents and pools. Pick the color with color, never with a class.
If a new state appears, add a token for it and use it.
From design/principles.md: never invent a new color for an outcome; if a new state appears, add a token and use it.
One hue per badge
The fill, the dot, the icon and the text are one ramp. A badge never mixes two.
An icon is never faded
An icon in a badge never takes an opacity. It is the color of the text beside it, or a solid token of its own.
Our icons are drawn from strokes that overlap, so a see-through color shows their joints. To make an icon quieter, give it a quieter solid color.
Color is never the only signal
A badge carries its meaning in its label. The color, the dot and the icon repeat it; they never replace it.
From design/principles.md (color is never the only signal: every status is a color and a label) and Atlassian; Apple: make sure badging isn't the only way you communicate essential information.
Counts
A count is a Badge
A number in a colored shape is a badge, whatever it counts. Build it with the Badge, at md for 11px digits, so its type, its red and its shape come from tokens.
Tabular digits and a cap
Give a count tabular-nums, so it keeps its width as it changes, and a cap with a plus past it; where the cap sits is the first open question. The assistant's own helper, formatBadgeCount, shows nothing at zero and 9+ past nine.
From Atlassian (a + past the maximum) and Material 3, for the cap; see the open question for where it sits.
Say what is counted
A count sits beside the word it counts, and screen readers hear both: hide the badge from them and say it in the label, as the sidebar does ("Dome Assistant (3 new)").
From Primer (always use a counter with adjacent text that says what the count is for) and Atlassian (don't use badges without context, unless they have a tooltip attached).
Labels
A word or two, in sentence case
A badge is a label, not a sentence. One word where you can, two when the state needs it, never capitals for emphasis.
A badge never wraps. If the text is long, it belongs in the line beside the badge.
From Polaris (a single word; two only for a complex state) and Atlassian (no title case, no all caps).
Name the state, not the action
A status says what is true now: Active, Suspended, Failed. A verb belongs on a button.
From Polaris: always use past tense for status labels (Refunded, not Refund).
Beside what it describes
Put a badge next to the name, the row or the title it is about, close enough that nobody has to wonder which.
From Polaris.
Not a control
A badge is read, never pressed
No click, no hover, no pointer. Something that filters, removes or opens is a button, a toggle or a menu item, and looks like one.
A count rides on something you press only through that component's own prop: a button group item's or a menu row's badge, a tab's count. A Button itself takes no badge (ds/README.md, Button group).
From Atlassian (lozenges are non-interactive). shadcn and Carbon differ: shadcn renders a badge as a link, Carbon has selectable and dismissible tags.
No ring, no border
A badge is a fill and nothing else. In the dashboard a 1px ring means "you can press this", so a badge never has one.
Built with the Badge
An Allow / Deny badge sets decision
Every badge that says Allow or Deny (Allowed, Denied) passes decision and its word, never an icon or a color. make lint-dashboard fails a Badge given CheckCircleFill, XCircleFill or a DECISION_ICON (DECISION_BADGE_RULES in ui/dashboard/eslint.config.mjs). Allow or Deny with an icon and no badge (a filter's value, a result) reads its icon from DECISION_ICON, exported beside the Badge. A table's outcome column is the status dot, not this (T9).
From .claude/rules/dashboard-ui.md, rule 14.
Never draw a badge by hand
A pill, a chip or a count in a screen is the Badge with its props. If the Badge can't do what you need, add the prop to the Badge and to its catalog page in the same change.
About a dozen hand-drawn chips are left: the pool members' +N, the caller history's Denied and Allowed, the plans' Popular, the judges' mode pill, the topology's count pills.
From the dashboard UI rules draft (rules 1 and 6, not merged yet). Apple: avoid creating a custom image or component that mimics the appearance or behavior of a badge.
A word in a colored shape is a Badge too
The same goes for a status drawn as a tinted span: it has a color, so it has a meaning, so it is one of the seven.
Props, not classes
className is for where a badge sits (a margin, tabular-nums, hiding it at a width). Its height, padding, radius, text size, weight, fill and text color are size, shape, color and emphasis.
Dozens of badges still set one of those with a class. Under the new design the dashboard's Badge drops such classes before it draws, so they no longer do anything but mislead the next reader. Take them out and set the prop.
What others expose
What shadcn, Atlassian, Polaris and Primer offer for badges, and where ours stands on each.
| They expose | Ours | Why |
|---|---|---|
| A solid fill for an important count (Atlassian's bold badges) | Already there | emphasis="high". |
| An icon before the label (Atlassian, Polaris, shadcn) | Already there | iconStart, and iconEnd. |
| A count-only badge (Primer, Atlassian) | Already there | One character makes a circle. |
| A spinner inside (shadcn) | Ask | iconStart takes an SDS icon only, and the Loader is not one. |
| A cap on a count, with a plus sign (Atlassian's max) | Ask | The first open question. |
| A badge that is a link (shadcn, Atlassian's tag) | Ask | Ours is read, never pressed. |
| A badge you can remove, with a close button (Atlassian's tag) | Ask | The right slot takes an icon, but it cannot be pressed. |
| A longest width, cut with an ellipsis (Atlassian) | Ask | Open question above. |
| More colors for categories people make themselves (Atlassian) | Ask | Ours has one identity color, fuchsia. |
| Hidden text that says the color's meaning (Polaris) | Ask | Ours has none; the label is what is read. |
| Outline and ghost variants (shadcn) | Not needed | Fill only, never a ring (ds/tokens/badge.css). |
| A larger size (Primer; Atlassian's lozenge has a spacious spacing) | Not needed | Nothing taller than 24px: too big for a badge (ds/README.md). |
| A progress pip (Polaris) | Ask | Ours has none; a dot or an icon says a state. |