Data display and layout
Diff
A before and after comparison; drag the divider, which is a native resize handle.
Example
<div class="diff aspect-video max-w-xl"><div class="diff-before"><div class="flex items-center bg-gradient-to-br from-primary to-accent p-6 text-2xl font-bold text-primary-foreground">Before</div></div><div class="diff-after"><div class="flex items-center justify-end bg-surface-3 p-6 text-2xl font-bold">After</div></div><div class="diff-resizer"></div></div>Classes
4 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 diff. On a <div> in the example. Sets grid display, grid tracks, overflow, corner radius, generated content and stacking order.CSS |
|
| Part | Part of the diff. On a <div> in the example. Sets stacking order, grid tracks, overflow, width and height.CSS |
|
| Part | Part of the diff. On a <div> in the example. Sets grid tracks, width and height.CSS |
|
| Part | Part of the diff. On a <div> in the example. Sets stacking order, grid tracks, width, height, alignment and overflow.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">
<!-- Diff: start from the base class, then add modifiers -->
<div class="diff aspect-video max-w-xl"><div class="diff-before"><div class="flex items-center bg-gradient-to-br from-primary to-accent p-6 text-2xl font-bold text-primary-foreground">Before</div></div><div class="diff-after"><div class="flex items-center justify-end bg-surface-3 p-6 text-2xl font-bold">After</div></div><div class="diff-resizer"></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.