Data display and layout
Stats
Key numbers with a title, value, description, figure and up or down trend.
Example
<div class="stats"><div class="stat"><p class="stat-title">Revenue</p><p class="stat-value">$48.2k</p><p class="stat-desc"><span class="stat-trend-up">12%</span> vs last month</p></div><div class="stat"><p class="stat-title">Active users</p><p class="stat-value">3,912</p><p class="stat-desc"><span class="stat-trend-up">4.1%</span> vs last month</p></div><div class="stat"><span class="stat-figure size-6"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3 4 6v6c0 5 3.5 8 8 9 4.5-1 8-4 8-9V6l-8-3Z"/></svg></span><p class="stat-title">Churn</p><p class="stat-value">1.8%</p><p class="stat-desc"><span class="stat-trend-down">0.3%</span> vs last month</p></div></div>Classes
9 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 stats. On a <div> in the example. Sets flex display, alignment, gap, overflow, border and corner radius.CSS |
|
| Modifier | Modifier, combined with the stats class. Not used in the example above. Sets alignment.CSS |
|
| Part | Part of the stats. On a <div> in the example. Sets alignment, grid display, grid tracks, gap, padding and background.CSS |
|
| Part | Part of the stats. On a <span> in the example. Sets text color.CSS |
|
| Part | Part of the stats. On a <p> in the example. Sets text size, font weight and text color.CSS |
|
| Part | Part of the stats. On a <p> in the example. Sets text size, font weight and text style.CSS |
|
| Part | Part of the stats. On a <p> in the example. Sets flex display, alignment, gap, text size and text color.CSS |
|
| Part | Part of the stats. On a <span> in the example. Sets inline-flex display, alignment, gap, padding, corner radius and background, and --tone.CSS |
|
| Part | Part of the stats. On a <span> in the example. Sets inline-flex display, alignment, gap, padding, corner radius and background, and --tone.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">
<!-- Stats: start from the base class, then add modifiers -->
<div class="stats"><div class="stat"><p class="stat-title">Revenue</p><p class="stat-value">$48.2k</p><p class="stat-desc"><span class="stat-trend-up">12%</span> vs last month</p></div><div class="stat"><p class="stat-title">Active users</p><p class="stat-value">3,912</p><p class="stat-desc"><span class="stat-trend-up">4.1%</span> vs last month</p></div><div class="stat"><span class="stat-figure size-6"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3 4 6v6c0 5 3.5 8 8 9 4.5-1 8-4 8-9V6l-8-3Z"/></svg></span><p class="stat-title">Churn</p><p class="stat-value">1.8%</p><p class="stat-desc"><span class="stat-trend-down">0.3%</span> vs last month</p></div></div>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
- 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.