A percentage meter needs both a bounded visual fill and a meaningful textual value. Handle a zero denominator before dividing.
Worked example
// components/PercentageMeter.tsx
export default function PercentageMeter({ value = 24 }: { value?: number } = {}) {
const pct = Math.min(100, Math.max(0, value));
return (
<label>
Utilization <meter min={0} max={100} value={pct} />
{pct}%
</label>
);
}Implementation notes
The native meter element describes a scalar measurement within a range. Use progress semantics instead when the number describes work toward completion.
Try it yourself
Try negative progress, over-completion and a target of zero.
Open the React example →Editorial date November 28, 2026 · Published December 6, 2026