# Badge: status labels in pure CSS

> iVOLT badge: small status labels in subtle and solid colour variants, sized and coloured from the design tokens. CSS only, no JavaScript involved.

Source: https://ivolt.intervolutions.com/components/badge · iVOLT 1.1.2 · English

A compact label for status or counts. Badges are not interactive; if the label matters to assistive technology, keep it as real text, not colour alone.

**CSS:** `css/components/badge.css` (in `ivolt.css`).

Couldn't load the demo. [Open alone](https://ivolt.intervolutions.com/stage/badge/variants.html?id=fx-badge-variants)

```html
<div class="iv-stack iv-u-gap-4">
  <div class="iv-cluster iv-u-gap-2">
    <span class="iv-badge">Draft</span>
    <span class="iv-badge iv-badge--primary">Primary</span>
    <span class="iv-badge iv-badge--success">Published</span>
    <span class="iv-badge iv-badge--warning">Needs review</span>
    <span class="iv-badge iv-badge--danger">Failed</span>
    <span class="iv-badge iv-badge--info">Beta</span>
  </div>
  <div class="iv-cluster iv-u-gap-2">
    <span class="iv-badge iv-badge--solid">Draft</span>
    <span class="iv-badge iv-badge--solid iv-badge--primary">Primary</span>
    <span class="iv-badge iv-badge--solid iv-badge--success">Published</span>
    <span class="iv-badge iv-badge--solid iv-badge--warning">Needs review</span>
    <span class="iv-badge iv-badge--solid iv-badge--danger">Failed</span>
    <span class="iv-badge iv-badge--solid iv-badge--info">Beta</span>
  </div>
  <p class="iv-u-m-0 iv-u-text-sm">
    A badge is a label, not a control. When the colour carries the only
    meaning, the text repeats it: <span class="iv-badge iv-badge--danger">Build failed</span>
  </p>
</div>
```

## Classes

`iv-badge` plus `--primary --success --warning --danger --info` (subtle background, coloured text) and `--solid` (filled). Without a variant the badge is neutral.

## Common mistakes

- Using a badge as a button; use `iv-button--sm` instead.
- Conveying state by colour only: include a word such as “Paid”.

## When to use a badge

A badge labels something that is already on the screen: the status of an invoice, the plan of an account, the number of unread items next to a link. It is read as part of the sentence or the row it sits in, so keep the word short and specific — “Paid”, “Beta”, “3 new” — and put the full explanation in the surrounding text.

If the label has to be clicked, it is a button (`iv-button iv-button--sm`); if it summarises a number that needs context, a [stat](https://ivolt.intervolutions.com/components/stat) says more; if it announces something that just happened, use an [alert](https://ivolt.intervolutions.com/components/alert) or a [toast](https://ivolt.intervolutions.com/components/toast).

## Customising

A variant only reassigns the tone locals, and `--solid` only swaps background and foreground, so any tone combines with `--solid` without a third class. To make a brand-new tone, set the locals on a class of your own:

```
.badge-teal {
  --iv-badge-tone: #0f766e;
  --iv-badge-tone-subtle: #ccfbf1;
  --iv-badge-on-tone: #ffffff;
}
```

Locals: `--iv-badge-tone`, `--iv-badge-tone-subtle`, `--iv-badge-on-tone`, `--iv-badge-bg`, `--iv-badge-fg`, `--iv-badge-border`, `--iv-badge-radius`. Check the contrast of a custom tone yourself; the shipped tones are tested in both themes.

## Class index

Parts and modifiers of this family that the examples above do not show. The full list per stylesheet lives in the [reference](https://ivolt.intervolutions.com/reference).

| Class | What it does |
| --- | --- |
| `iv-badge--primary` | Primary tone. |
| `iv-badge--info` | Informative tone. |
| `iv-badge--success` | Success tone. |
| `iv-badge--warning` | Warning tone. |
| `iv-badge--danger` | Danger tone. |
| `iv-badge--solid` | Filled variant: the tone becomes the background instead of the tint. |
