Skip to content

Badge

.bp-badge is an inline label element. It supports six semantic color variants (primary, success, warning, error, info, neutral) each available in three styles (solid default, subtle, outline). A __dot sub-element adds a status indicator. No JavaScript required.

Solid variants (default)

Primary Success Warning Error Info Neutral
<span class="bp-badge bp-badge--primary">Primary</span>
<span class="bp-badge bp-badge--success">Success</span>
<span class="bp-badge bp-badge--warning">Warning</span>
<span class="bp-badge bp-badge--error">Error</span>
<span class="bp-badge bp-badge--info">Info</span>
<span class="bp-badge bp-badge--neutral">Neutral</span>

Subtle variants

Primary Success Warning Error Info Neutral
<span class="bp-badge bp-badge--primary bp-badge--subtle">Primary</span>
<span class="bp-badge bp-badge--success bp-badge--subtle">Success</span>
<span class="bp-badge bp-badge--warning bp-badge--subtle">Warning</span>
<span class="bp-badge bp-badge--error bp-badge--subtle">Error</span>
<span class="bp-badge bp-badge--info bp-badge--subtle">Info</span>
<span class="bp-badge bp-badge--neutral bp-badge--subtle">Neutral</span>

Outline variants

Primary Success Warning Error Info Neutral
<span class="bp-badge bp-badge--primary bp-badge--outline">Primary</span>
<span class="bp-badge bp-badge--success bp-badge--outline">Success</span>
<span class="bp-badge bp-badge--warning bp-badge--outline">Warning</span>
<span class="bp-badge bp-badge--error bp-badge--outline">Error</span>
<span class="bp-badge bp-badge--info bp-badge--outline">Info</span>
<span class="bp-badge bp-badge--neutral bp-badge--outline">Neutral</span>

With dot indicator

Active Pending Failed Inactive
<span class="bp-badge bp-badge--success">
<span class="bp-badge__dot" aria-hidden="true"></span>Active
</span>
<span class="bp-badge bp-badge--warning bp-badge--subtle">
<span class="bp-badge__dot" aria-hidden="true"></span>Pending
</span>
<span class="bp-badge bp-badge--error bp-badge--outline">
<span class="bp-badge__dot" aria-hidden="true"></span>Failed
</span>
<span class="bp-badge bp-badge--neutral">
<span class="bp-badge__dot" aria-hidden="true"></span>Inactive
</span>

Sizes

Default Large
<span class="bp-badge bp-badge--success">Default</span>
<span class="bp-badge bp-badge--success bp-badge--lg">Large</span>

Badges attach to other components via the parent’s position: relative — the badge itself stays layout-agnostic.

Nav item with notification count

<style>
.demo-nav--with-badge { position: relative; }
.demo-nav--with-badge li { position: relative; }
.demo-nav__badge { position: absolute; top: -0.4rem; right: -0.6rem; }
</style>
<ul class="bp-nav demo-nav--with-badge" role="list">
<li>
<a class="bp-nav__link" href="#">
Inbox
<span class="bp-badge bp-badge--error demo-nav__badge"
aria-label="3 unread messages">3</span>
</a>
</li>
<li><a class="bp-nav__link" href="#">Settings</a></li>
</ul>

Card with status badge

Deploy #42

Live
Production deployment completed successfully.
<style>
.demo-card--badge { max-width: 22rem; }
.demo-card--badge .bp-card__header { flex-direction: row; align-items: center; justify-content: space-between; }
</style>
<div class="bp-card demo-card--badge">
<div class="bp-card__header">
<h3 class="bp-card__title">Deploy #42</h3>
<span class="bp-badge bp-badge--success bp-badge--subtle">
<span class="bp-badge__dot" aria-hidden="true"></span>Live
</span>
</div>
<div class="bp-card__body">Production deployment completed successfully.</div>
</div>
Use caseVariantStyle
Live / Active / Online--successsolid or subtle
Pending / In review--warningsubtle
Failed / Error / Blocked--errorsolid or outline
New / Informational--infosubtle
Draft / Inactive / Archived--neutralsolid
Feature / Brand highlight--primarysolid or subtle
Notification count--errorsolid
Category / Tag label--neutral or --primaryoutline
VariableDefaultDescription
--badge-bgvar(--bp-primary-subtle)Background color (overridden by semantic variant classes)
--badge-colorvar(--bp-primary-fg)Text color (overridden by semantic variant classes)
--badge-border1px solid transparentBorder
--badge-radiusvar(--bp-radius-full)Border radius
ClassDescription
bp-badge--primaryBrand/primary color
bp-badge--successGreen — active, live, done
bp-badge--warningOrange — pending, at risk
bp-badge--errorRed — failed, blocked, count
bp-badge--infoBlue — informational, neutral notices
bp-badge--neutralSubtle gray — inactive, draft
bp-badge--subtleLow-opacity tint style (combine with semantic)
bp-badge--outlineTransparent bg, colored border (combine with semantic)
bp-badge--lgLarger size for standalone use

Custom pill tag via public API

v2.0.0 archived
<style>
.demo-badge--version { --badge-bg: var(--bp-primary); --badge-color: var(--bp-primary-fg); --badge-radius: var(--bp-radius-md); }
.demo-badge--archived { --badge-radius: var(--bp-radius-sm); }
</style>
<span class="bp-badge demo-badge--version">v2.0.0</span>
<span class="bp-badge bp-badge--neutral demo-badge--archived">archived</span>
No axe violations tested 2026-05-11
  • Badges are decorative labels — they do not need role="status" unless their content updates dynamically.
  • When a badge conveys information not present in surrounding text (e.g. a count on a nav item), add aria-label to the badge: aria-label="3 unread messages".
  • The __dot element must always have aria-hidden="true" — its color meaning is already conveyed by the badge text.
  • Do not rely on color alone to convey meaning — pair color with text (e.g. “Active”, “Error”) or an icon with a text alternative.
  • Sufficient contrast: --success and --warning solid variants use color-mix-derived dark text for WCAG AA compliance. --error and --info solid variants use #fff — verify contrast if you change those token values. If you override --badge-bg, always verify contrast meets WCAG AA (4.5:1 for small text).
APIAvailabilityUsed forWithout itPolyfill
color-mix() Widely available Baseline 2023 Subtle variant tinted backgrounds; solid success/warning text color derivationSolid token color used insteadNone needed; @supports guard not required — fallback to solid is acceptable
  • --_bg, --_color, --_border, --_radius — component-private, do not set directly.