Monsoon v0.2.0
Made by Alexandre Kohler Star

Actions and feedback

Meter

A styled native meter that turns green, amber or red from its low, high and optimum values.

Actions and feedback6 classesNo JavaScriptLight and dark

Example

Full

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.

ClassTypeWhat 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
.meter::-webkit-meter-inner-element {
  display: block;
  height: 100%;
}

.meter:-moz-meter-sub-optimum::-moz-meter-bar {
  background: var(--warning);
}
Size Extra small size. Not used in the example above. Sets --meter-h.
CSS
.meter-xs {
  --meter-h: 0.25rem;
}
Size Small size. On a <meter> in the example. Sets --meter-h.
CSS
.meter-sm {
  --meter-h: 0.375rem;
}
Size Medium, the default size. Not used in the example above. Sets --meter-h.
CSS
.meter-md {
  --meter-h: 0.5rem;
}
Size Large size. On a <meter> in the example. Sets --meter-h.
CSS
.meter-lg {
  --meter-h: 0.75rem;
}
Size Extra large size. Not used in the example above. Sets --meter-h.
CSS
.meter-xl {
  --meter-h: 1rem;
}

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.

index.html
<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 progress or meter element, which exposes its value to assistive technology. Add a visible label or aria-label.
  • Every interactive part shows a visible focus ring with :focus-visible, and tone colors pair with -foreground tokens that keep text at 4.5:1 or better in light and dark mode.

No recent searches

Try , , or .

Recent

Loading the search index

No results for ""

Check the spelling, or search a class name such as px-4.