Actions and feedback
Spinner
Loading indicators: spinner, ring, dots, bars and pulse, in five sizes and eight tones.
Example
<div class="flex flex-wrap items-center gap-6" role="status" aria-label="Loading">
<span class="spinner spinner-primary"></span>
<span class="spinner spinner-ring spinner-success"></span>
<span class="spinner spinner-dots spinner-accent"></span>
<span class="spinner spinner-bars spinner-warning"></span>
<span class="spinner spinner-pulse spinner-info"></span>
<span class="spinner spinner-danger"></span>
<span class="spinner spinner-ring spinner-neutral"></span>
<span class="spinner spinner-dots spinner-secondary"></span>
</div>
<div class="flex flex-wrap items-center gap-6 mt-4">
<span class="spinner spinner-xs"></span>
<span class="spinner spinner-sm"></span>
<span class="spinner spinner-md"></span>
<span class="spinner spinner-lg"></span>
<span class="spinner spinner-xl spinner-primary"></span>
</div>Classes
18 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 spinner. On a <span> in the example. Sets inline-block display, alignment, width, corner radius, text color and background, and --tone, --spinner-size and --spinner-stroke.CSS |
|
| Modifier | Modifier, combined with the spinner class. On a <span> in the example. Sets background, border and animation.CSS |
|
| Modifier | Modifier, combined with the spinner class. On a <span> in the example. Sets corner radius, width, background and animation, and --spinner-dot and --spinner-bar.CSS |
|
| Modifier | Modifier, combined with the spinner class. On a <span> in the example. Sets corner radius, background and animation, and --spinner-dot and --spinner-bar.CSS |
|
| Modifier | Modifier, combined with the spinner class. On a <span> in the example. Sets background and animation.CSS |
|
| Size | Extra small size. On a <span> in the example. Sets --spinner-size.CSS |
|
| Size | Small size. On a <span> in the example. Sets --spinner-size.CSS |
|
| Size | Medium, the default size. On a <span> in the example. Sets --spinner-size.CSS |
|
| Size | Large size. On a <span> in the example. Sets --spinner-size.CSS |
|
| Size | Extra large size. On a <span> in the example. Sets --spinner-size.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 and --tone-fg.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 |
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">
<!-- Spinner: start from the base class, then add modifiers -->
<div class="flex flex-wrap items-center gap-6" role="status" aria-label="Loading">
<span class="spinner spinner-primary"></span>
<span class="spinner spinner-ring spinner-success"></span>
<span class="spinner spinner-dots spinner-accent"></span>
<span class="spinner spinner-bars spinner-warning"></span>
<span class="spinner spinner-pulse spinner-info"></span>
<span class="spinner spinner-danger"></span>
<span class="spinner spinner-ring spinner-neutral"></span>
<span class="spinner spinner-dots spinner-secondary"></span>
</div>
<div class="flex flex-wrap items-center gap-6 mt-4">
<span class="spinner spinner-xs"></span>
<span class="spinner spinner-sm"></span>
<span class="spinner spinner-md"></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
- Announces itself with
role="status"(polite) orrole="alert"(assertive). Use alert only for messages that need immediate attention. - Animations stop under
prefers-reduced-motion: reduce. Mark busy regions witharia-busy="true"and give spinners an accessible name. - 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.