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
<span class="badge">Default</span>Background colors
Combine .badge with a background utility.
PrimarySecondarySuccessWarningErrorInverse
<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
<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.
| Token | Default | Purpose | Scope / state |
|---|---|---|---|
--badge-padding-y | var(--spacer-1) | Top and bottom padding. | .badge |
--badge-padding-x | var(--spacer-2) | Left and right padding. | .badge |
--badge-border-radius | 9999px | Corner radius. | .badge |
--badge-font-size | var(--font-size-xs) | Text size. | .badge |
--badge-font-weight | 400 | Text weight. | .badge |
--badge-bg-color | var(--bg-highlight) | Background color. | .badge |
--badge-color | var(--text-color) | Text and icon color. | .badge |
--badge-border-width | var(--border-width) | Border thickness. | .badge |
--badge-border-color | transparent | Border color. | .badge |