Dev Helpers

React / Numbers and units

Percentage meter

Dev Helpers · November 28, 2026

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

Related articles

Vertical typesetting sample

Vertical typesetting changes the reading direction and available inline space. Treat the sample text as content so it remains selectable and accessible.

Square cover crop

A square image crop gives a card grid consistent geometry. The crop anchor determines whether the most important part of a photo survives.

Batch weight summary

Batch weight combines quantity and unit weight. Convert all measurements to the same unit before aggregating them.