Actions and feedback
Indicator
Places a badge or status dot on any corner or edge of another element.
Example
<div class="flex flex-wrap items-center gap-8 p-2">
<div class="indicator">
<span class="indicator-item badge badge-danger badge-solid badge-sm badge-pill">9</span>
<button class="btn btn-outline btn-neutral btn-square" aria-label="Notifications"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.9 1.9 0 0 0 3.4 0"/></svg></button>
</div>
<div class="indicator">
<span class="indicator-item indicator-bottom status status-online status-lg"></span>
<div class="size-12 rounded-xl bg-primary"></div>
</div>
<div class="indicator">
<span class="indicator-item indicator-start badge badge-primary badge-solid badge-sm">New</span>
<div class="h-12 w-24 rounded-lg border bg-surface"></div>
</div>
<div class="indicator">
<span class="indicator-item indicator-center badge badge-sm">Center</span>
<div class="h-12 w-24 rounded-lg border bg-surface"></div>
</div>
</div>Classes
8 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 indicator. On a <div> in the example. Sets inline-flex display and width.CSS |
|
| Modifier | Modifier, combined with the indicator class. On a <span> in the example. Sets absolute position, stacking order, offsets, transform, text style and shadow, and --ix and --iy.CSS |
|
| Modifier | Modifier, combined with the indicator class. On a <span> in the example. Sets offsets, and --ix.CSS |
|
| Modifier | Modifier, combined with the indicator class. On a <span> in the example. Sets offsets, and --ix.CSS |
|
| Modifier | Modifier, combined with the indicator class. Not used in the example above. Sets offsets, and --ix.CSS |
|
| Modifier | Modifier, combined with the indicator class. Not used in the example above. Sets offsets, and --iy.CSS |
|
| Modifier | Modifier, combined with the indicator class. Not used in the example above. Sets offsets, and --iy.CSS |
|
| Modifier | Modifier, combined with the indicator class. On a <span> in the example. Sets offsets, and --iy.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">
<!-- Indicator: start from the base class, then add modifiers -->
<div class="flex flex-wrap items-center gap-8 p-2">
<div class="indicator">
<span class="indicator-item badge badge-danger badge-solid badge-sm badge-pill">9</span>
<button class="btn btn-outline btn-neutral btn-square" aria-label="Notifications"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.9 1.9 0 0 0 3.4 0"/></svg></button>
</div>
<div class="indicator">
<span class="indicator-item indicator-bottom status status-online status-lg"></span>
<div class="size-12 rounded-xl bg-primary"></div>
</div>
<div class="indicator">
<span class="indicator-item indicator-start badge badge-primary badge-solid badge-sm">New</span>
<div class="h-12 w-24 rounded-lg border bg-surface"></div>
</div>
<div class="indicator">
<!-- 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.