WebberUI

Gauge Meter

Needle gauge: a spring-swinging needle, banded color arcs, and a rolling value.

An SVG semicircular gauge whose needle swings to the target value on a low-damping spring, overshooting and settling back. Banded color arcs (green/amber/red, with customizable stops) sit alongside tick marks, the central value shares the same spring as the needle so the two roll in sync, and the color bands the needle has not yet reached are dimmed.

Loading preview…
npx shadcn@latest add https://webberui.com/r/gauge-meter.json

Playground

Tune the props live — the code snippet updates as you go, so you can dial in the look you want before copying it.

72
240
0
<GaugeMeter />

Installation

npx shadcn@latest add https://webberui.com/r/gauge-meter.json

Or, once registries are configured in components.json, install it as @webberui/gauge-meter.

Usage

import { GaugeMeter } from "@/components/ui/gauge-meter";

<GaugeMeter
  value={72}
  unit="%"
  label="CPU usage"
  stops={[
    { to: 60, color: "#10b981", label: "Smooth" },
    { to: 85, color: "#f59e0b", label: "Elevated" },
    { to: 100, color: "#ef4444", label: "Overloaded" },
  ]}
/>

Props

PropTypeDefaultDescription
valuenumberThe target value; when it changes, the needle swings there on a spring (overshooting and settling back)
minnumber0Minimum of the gauge
maxnumber100Maximum of the gauge
stopsGaugeStop[]green/amber/red defaultBanded color arc configuration, each band { to, color, label? }; when omitted, green/amber/red at 60% / 85% / 100% is used
unitstringUnit text after the value, such as "%" or "km/h"
labelstringGauge title, shown below the gauge
sizenumber240Gauge width (px); the height scales automatically at a 200:148 ratio
decimalsnumber0Decimal places shown for the central value
classNamestringForwarded to the outer container

GaugeStop: to is the end value of that color band (the bands must increase, and the last one should ideally equal max), color is any valid CSS color, and label is the status text shown when the current value falls inside that band.

Accessibility

  • The container uses role="meter" together with aria-valuemin / aria-valuemax / aria-valuenow and aria-valuetext, so assistive technology announces the target value rather than an intermediate animation value
  • The SVG itself is marked aria-hidden to avoid announcing the same thing twice alongside the meter semantics
  • When the user has "reduce motion" enabled at the system level, the needle and the number jump straight to the target value with no spring swing played
  • The value uses tabular-nums monospaced figures, so the layout does not judder while it rolls

On this page