On this page

InstallationUsageAnatomySizesColorsEmphasisShapeStatus dotWith an iconIcon at the endIcon onlyCountsCarried by other componentsThe colors, measuredIn the dashboardAccessibilityAPI ReferenceBadgeRulesOpen questionsEmphasisShape and sizeColorCountsLabelsNot a controlBuilt with the BadgeWhat others expose

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.

ActivePreview9+
1<Badge color="success" dot>Active</Badge>2<Badge color="info">Preview</Badge>3<Badge color="error" emphasis="high" size="md" className="tabular-nums">9+</Badge>

Installation

text
import { Badge } from "@dome-systems/ds-dashboard/components";

Usage

text
<Badge color="success" dot>Active</Badge>

Anatomy

Active 1234
  1. 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. 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. 3 — Label. A word or two in the color's text, medium weight, or a count.
  4. 4 — Right slot. An end icon, in the text's color.
SizeHeightTextIconPill's sideIcon to text
lg24pxlabel-3, 12px12px10px4px
md20pxlabel-4, 11px10px8px4px
sm16pxlabel-5, 10px10px6px3px

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.

ActiveActiveActive
1<Badge color="success" size="lg">Active</Badge>2<Badge color="success" size="md">Active</Badge>3<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.

DraftNewActiveStaleFailedPreviewPool
1<Badge color="neutral">Draft</Badge>2<Badge color="primary">New</Badge>3<Badge color="success">Active</Badge>4<Badge color="warning">Stale</Badge>5<Badge color="error">Failed</Badge>6<Badge color="info">Preview</Badge>7<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.

Failed9+
1<Badge color="error">Failed</Badge>2<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.

DraftDraft
1<Badge>Draft</Badge>2<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. With a dot, iconStart is not drawn.

ActiveDegradedUnreachable
1<Badge color="success" dot>Active</Badge>2<Badge color="warning" dot>Degraded</Badge>3<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.

Verified Scheduled Pool
1<Badge color="success" iconStart={CheckCircle}>Verified</Badge>2<Badge color="neutral" iconStart={Clock}>Scheduled</Badge>3<Badge color="fuchsia" iconStart={Layers}>Pool</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.

Limited
1<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.

1<Badge color="success" iconStart={Check} aria-label="Verified" />2<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.

39+12
1<Badge color="error" emphasis="high" size="md" className="tabular-nums">3</Badge>2<Badge color="error" emphasis="high" size="md" className="tabular-nums">9+</Badge>3<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.

Agents12
Denials3
1<CardTitle count={12}>Agents</CardTitle>2<CardTitle count={{ value: 3, color: "error", emphasis: "high" }}>Denials</CardTitle>3
4<ButtonGroup size="sm" aria-label="Issues">5  <ButtonGroupItem badge={{ label: "4", color: "neutral" }}>Open</ButtonGroupItem>6  <ButtonGroupItem badge={{ label: "12", color: "neutral" }}>Closed</ButtonGroupItem>7</ButtonGroup>8
9<DropdownMenuItem badge={{ label: "Preview", color: "info" }}>Guards</DropdownMenuItem>10<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.

ColorLowHigh
neutralDraftGray 1300 at 22%, secondary text. Text 4.9 to 1.DraftGray 1900. White 15.2 to 1.
primaryNewPurple 400 at 32% on the card, text 1000. Text 6.8 to 1.NewPurple 800. White 5.4 to 1.
successActiveIts own, beside green 200; text beside 1100. Text 6.2 to 1.ActiveIts own, beside green 900. White 3.9 to 1, picked.
warningStaleIts own, beside orange 200; text beside 1100. Text 6.7 to 1.StaleIts own, beside orange 600. White 2.3 to 1, picked.
errorFailedRed 700 at 28% on the card, text 1100. Text 6.1 to 1.FailedRed 900. White 4.6 to 1.
infoPreviewBlue 200, text 1100. Text 6.0 to 1.PreviewBlue 900. White 4.1 to 1, picked.
fuchsiaPoolIts 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.

Active Provisioned SuspendedRevoked

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

Allow Deny

A decision

What a rule, a judge or a guard decided: allow or deny, with its glyph. About 15.

components/judges/outcome-badge.tsx

AgentGatewayToolModelPool

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

WebhookSchedule

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

DefaultRequiredBuilt-in

A marker

One thing about an item: Default, Required, Recommended, Built-in. Neutral, often small. About 37.

components/shared/default-badge.tsx

AdminOperatorViewerImpersonator

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

Preview

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

12128

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

39+

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

WebhookDefault

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).

PropTypeDefaultDescription
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.
dotboolean | { 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. With a dot, iconStart is not drawn.
iconStartIconComponent—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.
iconEndIconComponent—A glyph after the label, in the text's color.
tooltipstring | 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.
childrenReactNode—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+?

Open
Ours

The assistant's count shows 9+ past nine. The other counts, about twenty, show the raw number.

Other systems

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?

Open
Ours

Badges 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.

Other systems

Polaris, Primer, Carbon and Material use one shape for everything.

Resource badges borrow the status colors

Open
Ours

A 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.

Other systems

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

Open
Ours

The 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.

Other systems

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?

Open
Ours

It 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.

Other systems

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?

Open
Ours

A 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.

Other systems

Atlassian's tooltip page says never to use the title attribute.

How is a badge with no label named?

Open
Ours

The 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.

Other systems

Polaris's badge takes hidden text that says what its tone and progress mean.

Emphasis

billing-syncActive
DoStatuses sit quietly beside their rows.
billing-syncActive
Don’tA row of solid badges shouts, and none of them wins.

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.

Suggestions3
DoA count of things waiting for you.
Failed
Don’tA solid word beside a button looks like a second button.

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

Preview9+
Do
9+
Don’tA small square chip reads as a key or a tag, not as a badge.

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.

billing-syncPreview
Domd in a dense row, the same on every row.
billing-syncPreview
Don’tAn 18px badge made with classes: a fourth size.

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

ActiveDegradedFailed
Do
ActiveDegraded
Don’tFuchsia is not a status, and a class is not a 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.

Scheduled
Do
Scheduled
Don’tA blue fill under green text is two meanings in one badge.

One hue per badge

The fill, the dot, the icon and the text are one ramp. A badge never mixes two.

Notified Notified
DoThe icon is the text's color, at full strength.
Notified Notified
Don’tHalf as strong: the icon stops matching its label, and where its strokes meet it shows darker.

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.

Unreachable
Do
GatewayGateway
Don’tThe same word in green and in red: only the color says which one is down.

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

9+
Do
9+
Don’tThe sidebar's old count: a styled span with its own size, weight and red.

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.

9+
Do
1284
Don’tAn uncapped count grows until it pushes the row around.

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.

Suggestions3
Do
3
Don’tThree what?

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

ActiveNeeds review
Do
ALLOWThis agent needs a review
Don’tThe simulator's ALLOW and DENY, and the audit table's uppercase 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).

Suspended
Do
Suspend
Don’tReads as something to press.

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

4
DoThe link is a link; the badge beside it only says how many.
View pools
Don’tA badge with a pointer, a hover or a click.

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.

Draft
Do
Draft
Don’tAn edge is what a control has.

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

+3
DoThe Badge, neutral, md.
+3
Don’tThe model pools' overflow chip: a span, 18px, a size no badge has.

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.

DeniedPopular
Do
DeniedPopular
Don’tThe caller history's Denied and the plans' Popular: palette classes, raw sizes, capitals.

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.

Tools to review4
Dosize="sm": 16px, from the Badge.
Tools to review4
Don’tThe Gateways page's counts: h-4 min-w-4 rounded-sm px-1 text-body-5 on a Badge.

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 exposeOursWhy
A solid fill for an important count (Atlassian's bold badges)Already thereemphasis="high".
An icon before the label (Atlassian, Polaris, shadcn)Already thereiconStart, and iconEnd.
A count-only badge (Primer, Atlassian)Already thereOne character makes a circle.
A spinner inside (shadcn)AskiconStart takes an SDS icon only, and the Loader is not one.
A cap on a count, with a plus sign (Atlassian's max)AskThe first open question.
A badge that is a link (shadcn, Atlassian's tag)AskOurs is read, never pressed.
A badge you can remove, with a close button (Atlassian's tag)AskThe right slot takes an icon, but it cannot be pressed.
A longest width, cut with an ellipsis (Atlassian)AskOpen question above.
More colors for categories people make themselves (Atlassian)AskOurs has one identity color, fuchsia.
Hidden text that says the color's meaning (Polaris)AskOurs has none; the label is what is read.
Outline and ghost variants (shadcn)Not neededFill only, never a ring (ds/tokens/badge.css).
A larger size (Primer; Atlassian's lozenge has a spacious spacing)Not neededNothing taller than 24px: too big for a badge (ds/README.md).
A progress pip (Polaris)AskOurs has none; a dot or an icon says a state.