Actions and feedback
Badge
Small labels for counts and states in solid, soft and outline styles, with an optional status dot.
Example
<div class="flex flex-wrap items-center gap-2">
<span class="badge">Draft</span>
<span class="badge badge-primary">New</span>
<span class="badge badge-success badge-dot">Active</span>
<span class="badge badge-warning badge-dot">Pending</span>
<span class="badge badge-danger badge-solid">Overdue</span>
<span class="badge badge-info badge-outline">Beta</span>
<span class="badge badge-accent badge-solid badge-pill">Pro</span>
<span class="badge badge-secondary">Archived</span>
<span class="badge badge-neutral badge-solid">v2.4.0</span>
</div>
<div class="flex flex-wrap items-center gap-2 mt-3">
<span class="badge badge-primary badge-solid badge-xs">xs</span>
<span class="badge badge-primary badge-solid badge-sm">sm</span>
<span class="badge badge-primary badge-solid badge-md">md</span>
<span class="badge badge-primary badge-solid badge-lg">lg</span>
<span class="badge badge-primary badge-solid badge-xl">xl</span>
<button class="btn btn-outline btn-neutral btn-sm">Inbox <span class="badge badge-primary badge-solid badge-sm badge-pill">12</span></button>
</div>Classes
19 classes. Click a name to copy it. Utilities on the same element always win over component defaults, so any of them can be adjusted with plain utility classes.
| Class | Type | What it does |
|---|---|---|
| Base | Base class of the badge. On a <span> in the example. Sets inline-flex display, alignment, gap, height, width and padding, and 11 custom properties.CSS |
|
| Tone | Primary tone. On a <span> in the example. Sets --tone and --tone-fg.CSS |
|
| Tone | Secondary tone. On a <span> in the example. Sets --tone, --tone-fg and --tone-tint.CSS |
|
| Tone | Accent tone. On a <span> in the example. Sets --tone and --tone-fg.CSS |
|
| Tone | Neutral tone. On a <span> in the example. Sets --tone and --tone-fg.CSS |
|
| Tone | Success tone. On a <span> in the example. Sets --tone and --tone-fg.CSS |
|
| Tone | Warning tone. On a <span> in the example. Sets --tone and --tone-fg.CSS |
|
| Tone | Danger tone. On a <span> in the example. Sets --tone and --tone-fg.CSS |
|
| Tone | Info tone. On a <span> in the example. Sets --tone and --tone-fg.CSS |
|
| Modifier | Modifier, combined with the badge class. On a <span> in the example. Sets background, and --badge-bg, --badge-fg and --badge-border.CSS |
|
| Modifier | Modifier, combined with the badge class. Not used in the example above. Sets --badge-bg, --badge-fg and --badge-border.CSS |
|
| Modifier | Modifier, combined with the badge class. On a <span> in the example. Sets --badge-bg, --badge-fg and --badge-border.CSS |
|
| Size | Extra small size. On a <span> in the example. Sets --badge-h, --badge-px and --badge-fs.CSS |
|
| Size | Small size. On a <span> in the example. Sets --badge-h, --badge-px and --badge-fs.CSS |
|
| Size | Medium, the default size. On a <span> in the example. Sets --badge-h, --badge-px and --badge-fs.CSS |
|
| Size | Large size. On a <span> in the example. Sets --badge-h, --badge-px and --badge-fs.CSS |
|
| Size | Extra large size. On a <span> in the example. Sets --badge-h, --badge-px and --badge-fs.CSS |
|
| Modifier | Modifier, combined with the badge class. On a <span> in the example. Sets generated content, alignment, width, height, margin and corner radius.CSS |
|
| Modifier | Modifier, combined with the badge class. On a <span> in the example. Sets corner radius.CSS |
Usage
Components ship inside the same stylesheet as the utilities. There is nothing else to install and no script to load: link Monsoon and write the markup.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/monsooncss">
<!-- Badge: start from the base class, then add modifiers -->
<div class="flex flex-wrap items-center gap-2">
<span class="badge">Draft</span>
<span class="badge badge-primary">New</span>
<span class="badge badge-success badge-dot">Active</span>
<span class="badge badge-warning badge-dot">Pending</span>
<span class="badge badge-danger badge-solid">Overdue</span>
<span class="badge badge-info badge-outline">Beta</span>
<span class="badge badge-accent badge-solid badge-pill">Pro</span>
<span class="badge badge-secondary">Archived</span>
<span class="badge badge-neutral badge-solid">v2.4.0</span>
</div>
<div class="flex flex-wrap items-center gap-2 mt-3">
<span class="badge badge-primary badge-solid badge-xs">xs</span>
<span class="badge badge-primary badge-solid badge-sm">sm</span>
<!-- the full example is in the Code tab above -->Theme it with --seed on any ancestor, for example style="--seed: #0d9488", and force a scheme with class="dark" or class="light" on a wrapper.
Accessibility
- Use
buttonfor actions andafor navigation. Icon only buttons need anaria-label; decorative icons carryaria-hidden="true". - Every interactive part shows a visible focus ring with
:focus-visible, and tone colors pair with-foregroundtokens that keep text at 4.5:1 or better in light and dark mode.