Meter
Native <meter> for a value inside a known range. It turns green, amber or red from low, high and optimum.
How it helpsThe browser picks the colour from the thresholds you give it, so a budget bar needs no JavaScript.
Budget usage
export default function Example() {
return (
<>
<div className="flex flex-col gap-3 w-full">
<label>Groceries · 40% <meter min="0" max="100" low="70" high="90" optimum="0" value="40"></meter></label>
<label>Dining · 78% <meter min="0" max="100" low="70" high="90" optimum="0" value="78"></meter></label>
<label>Shopping · 96% <meter min="0" max="100" low="70" high="90" optimum="0" value="96"></meter></label>
</div>
</>
);
}<div class="flex flex-col gap-3 w-full">
<label>Groceries · 40% <meter min="0" max="100" low="70" high="90" optimum="0" value="40"></meter></label>
<label>Dining · 78% <meter min="0" max="100" low="70" high="90" optimum="0" value="78"></meter></label>
<label>Shopping · 96% <meter min="0" max="100" low="70" high="90" optimum="0" value="96"></meter></label>
</div>API
| Name | Type | Description |
|---|---|---|
value, min, max | attr | The measurement. |
low, high, optimum | attr | Thresholds that drive the colour. |