Badge

Small labels for counts, states or metadata.

When to use

Use a badge for a short status, count or category within related content. Use a Chip when the item represents an interactive filter, removable input or action.

Default

Use .badge for a passive label.

Default
HTML
<span class="badge">Default</span>

Background colors

Combine .badge with a background utility.

PrimarySecondarySuccessWarningErrorInverse
HTML
<span class="badge bg-primary">Primary</span>
<span class="badge bg-secondary">Secondary</span>
<span class="badge bg-success">Success</span>
<span class="badge bg-warning">Warning</span>
<span class="badge bg-error">Error</span>
<span class="badge bg-inverse">Inverse</span>

Outline

Add .badge-outline for an outline.

PrimaryActiveFailed
HTML
<span class="badge badge-outline text-primary">Primary</span>
<span class="badge badge-outline text-success">Active</span>
<span class="badge badge-outline text-error">Failed</span>

Accessibility and behavior

  • Keep status or category meaning in text; a color alone does not identify the state.
  • A badge is passive and does not need a tab stop. Use a native link or button when the surrounding content has an action.
  • For changing counts, decide whether a separate concise live status is needed. Avoid announcing every visual badge independently.

CSS variables

Override these base defaults on the listed selector after the library styles. Variants and states may replace them; global tokens follow the active theme.

TokenDefaultPurposeScope / state
--badge-padding-yvar(--spacer-1)Top and bottom padding..badge
--badge-padding-xvar(--spacer-2)Left and right padding..badge
--badge-border-radius9999pxCorner radius..badge
--badge-font-sizevar(--font-size-xs)Text size..badge
--badge-font-weight400Text weight..badge
--badge-bg-colorvar(--bg-highlight)Background color..badge
--badge-colorvar(--text-color)Text and icon color..badge
--badge-border-widthvar(--border-width)Border thickness..badge
--badge-border-colortransparentBorder color..badge