Loading...
Loading...
> A circular gauge component for displaying metrics, scores, and progress with a rotating needle indicator.
1import { Gauge, ScoreGauge } from "@/components/ui/gauge";
75
Performance
1<Gauge2 value={75}3 label="Performance"4 showValue={true}5/>
3500$
Revenue
42%
CPU Usage
1<Gauge2 value={3500}3 min={0}4 max={5000}5 label="Revenue"6 unit="$"7 showValue={true}8/>9<Gauge10 value={42}11 min={0}12 max={100}13 label="CPU Usage"14 unit="%"15 showValue={true}16 color="oklch(70% 0.15 60)"17/>
65%
Battery Level
1<Gauge2 value={65}3 min={0}4 max={100}5 label="Battery Level"6 unit="%"7 showValue={true}8 showMinMax={true}9 color="oklch(70% 0.15 160)"10/>
80
Small
45
Large
1<Gauge2 value={80}3 size={150}4 thickness={15}5 label="Small"6 showValue={true}7/>8<Gauge9 value={45}10 size={250}11 thickness={25}12 label="Large"13 showValue={true}14 color="oklch(70% 0.15 295)"15/>
92
Excellent
68
Good
35
Needs Work
1<ScoreGauge2 score={92}3 maxScore={100}4 label="Excellent"5 size={180}6/>7<ScoreGauge8 score={68}9 maxScore={100}10 label="Good"11 size={180}12/>13<ScoreGauge14 score={35}15 maxScore={100}16 label="Needs Work"17 size={180}18/>
75
Quality Score
1<Gauge2 value={75}3 min={0}4 max={100}5 label="Quality Score"6 showValue={true}7 showMinMax={true}8 segments={[9 { value: 30, color: "oklch(60% 0.20 25)", label: "Poor" },10 { value: 30, color: "oklch(70% 0.15 60)", label: "Fair" },11 { value: 40, color: "oklch(70% 0.15 160)", label: "Good" },12 ]}13/>
| Prop | Type | Default | Description |
|---|---|---|---|
| value* | number | - | Current value to display |
| min | number | 0 | Minimum value |
| max | number | 100 | Maximum value |
| size | number | 200 | Gauge diameter in pixels |
| thickness | number | 20 | Arc thickness in pixels |
| startAngle | number | -135 | Starting angle in degrees |
| endAngle | number | 135 | Ending angle in degrees |
| color | string | "var(--color-primary)" | Arc color |
| backgroundColor | string | "var(--color-muted)" | Background arc color |
| showValue | boolean | true | Display value below gauge |
| showMinMax | boolean | false | Display min/max labels on gauge |
| label | string | - | Label text below value |
| unit | string | - | Unit suffix for value |
| segments | Array<{ value: number; color: string; label?: string }> | - | Colored segments for gauge arc |
| className | string | - | Additional CSS classes |