StealThis .dev

Gauge Meter

A half-circle SVG gauge meter with animated needle, color zones (green/yellow/red), tick marks, a value label, and configurable min/max range. Ideal for dashboards showing a single KPI.

Open in Lab
svg react tailwind vue svelte
Targets: TS JS HTML React Vue Svelte

Code

Features

  • Animated needle — smooth rotation via CSS/SVG transform
  • Color arc zones — configurable thresholds for green / yellow / red bands
  • Tick marks — major and minor tick marks around the arc
  • Value label — displays current value + unit below the needle pivot
  • Min/Max range — fully configurable numeric range

How it works

  1. The arc is drawn with SVG <path> using polar-to-cartesian math
  2. Color zones are separate arc segments rendered in z-order
  3. The needle is an SVG <line> rotated via transform: rotate(Xdeg) around the pivot
  4. Rotation angle maps linearly from minAngle to maxAngle across the value range