Skip to content

Badge

Default Secondary Destructive Outline Ghost Link
<span class="badge">Default</span>
<span class="badge badge-secondary">Secondary</span>
Default Secondary Destructive Outline Ghost Link
ClassUse
.badgeDefault, filled with the primary colour
.badge-secondaryLower emphasis
.badge-destructiveErrors and danger states — a wash, not a solid fill
.badge-outlineBorder only
.badge-ghostNo surface until hovered
.badge-linkReads as a link; put it on an <a>

Only .badge-ghost and .badge-link react to the pointer on their own. The filled variants take a hover surface when the badge is an <a>, since a plain <span> is not something you can activate.

Mark the icon with data-icon="inline-start" or data-icon="inline-end" so the padding tightens on that side. An svg child is sized to 12px automatically.

Deployed Failed Queued
Deploying

The badge’s text already says what is happening, so the spinner takes aria-hidden="true" rather than announcing itself a second time.

An anchor keeps its own semantics — it navigates and is in the tab order. That is also what turns on the hover surface for the filled variants.

The classes set colour last, so an inline style or a class of your own overrides them. Reach for light-dark() rather than one fixed pair — partialkit sets color-scheme on the root, so the function resolves to the theme in use without a media query or a second class.

Passing Warning Preview

Set dir="rtl" on the page or on any subtree — padding, corners and positions follow the reading direction on their own. See the button page for a live example.

A badge is decorative markup: it has no role and is not focusable. When it carries state a user must know about, put that state in text as well, or give the badge an accessible name.

<span class="badge badge-destructive">
<span class="sr-only">Build status:</span>
Failed
</span>