Actions and feedback
Meter
A styled native meter that turns green, amber or red from its low, high and optimum values.
Example
<div class="space-y-3">
<meter class="meter" min="0" max="100" low="30" high="80" optimum="100" value="88">88</meter>
<meter class="meter meter-lg" min="0" max="100" low="30" high="80" optimum="100" value="55">55</meter>
<meter class="meter meter-sm" min="0" max="100" low="30" high="80" optimum="100" value="18">18</meter>
</div>Classes
6 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 meter. On a <meter> in the example. Sets block display, width, height, overflow, border and corner radius, and --meter-h.CSS |
|
| Size | Extra small size. Not used in the example above. Sets --meter-h.CSS |
|
| Size | Small size. On a <meter> in the example. Sets --meter-h.CSS |
|
| Size | Medium, the default size. Not used in the example above. Sets --meter-h.CSS |
|
| Size | Large size. On a <meter> in the example. Sets --meter-h.CSS |
|
| Size | Extra large size. Not used in the example above. Sets --meter-h.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">
<!-- Meter: start from the base class, then add modifiers -->
<div class="space-y-3">
<meter class="meter" min="0" max="100" low="30" high="80" optimum="100" value="88">88</meter>
<meter class="meter meter-lg" min="0" max="100" low="30" high="80" optimum="100" value="55">55</meter>
<meter class="meter meter-sm" min="0" max="100" low="30" high="80" optimum="100" value="18">18</meter>
</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
- Uses the native
progressormeterelement, which exposes its value to assistive technology. Add a visible label oraria-label. - 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.