Gauge
Notch-based radial gauge with PieCenter-style NumberFlow, theme fills, optional patterns and arc gradients, and responsive sizing
Preview
Installation
pnpm dlx shadcn@latest add @bklit/gauge-chartUsage
Gauge draws notches around an arc and uses PieCenterShell so the center matches donut PieChart / PieCenter (NumberFlow + label) without mounting slices.
- Fill vs center:
valueis the arc fill 0–100.centerValueis the statistic passed to the center (often the same story or a related KPI). - Responsive: omit
widthandheightto fill the parent; the root usesminWidth(default 300) and an aspect ratio so layout stays stable. Pass explicitwidth/heightfor fixed layouts. - Patterns / gradients in
<defs>: passPatternLines,LinearGradient, etc. aschildren(same idea asPieChart), then setactiveFill/inactiveFilltourl(#id). - Arc gradients: set
useGradient. OptionalactiveGradientandinactiveGradientare[hexFrom, hexTo]tuples (interpolated along the notch index). - Fill opacity:
activeFillOpacityandinactiveFillOpacitymap to SVGfill-opacity(0–1). Defaults are 1 for active notches and 0.8 for the track; docs and gallery examples useinactiveFillOpacity={0.4}for a lighter track. - Corner radius:
notchCornerRadiusis the fillet in pixels at each notch corner (0 = sharp). Large values are clamped by edge length and radial depth so shapes can approach a capsule / near-circular look.
import { Gauge, PatternLines } from "@bklitui/ui/charts";
export default function RevenueGauge() {
return (
<Gauge
value={66}
centerValue={428_000}
spacing={25}
inactiveFillOpacity={0.4}
defaultLabel="ARR run rate"
formatOptions={{
style: "currency",
currency: "USD",
maximumFractionDigits: 0,
}}
/>
);
}Props
Gauge
| Prop | Type | Default | Description |
|---|---|---|---|
value | number | required | Arc fill 0–100 |
centerValue | number | required | Center statistic (NumberFlow) |
totalNotches | number | 40 | Notch count |
spacing | number | 25 | % of the arc used as gaps between notches |
notchLengthPercent | number | 100 | Radial notch depth as % of default (5–100); lower = shorter notches |
notchCornerRadius | number | 0 | Corner fillet in px (0 = sharp); large values clamp toward a capsule shape |
uniformWidth | boolean | false | Rectangular notches vs tapered |
startAngle / endAngle | number | 135 / 405 | Arc sweep in degrees |
useGradient | boolean | false | Per-notch color ramp along the arc |
activeGradient | [string, string] | lime → emerald | Hex stops for active notches when useGradient |
inactiveGradient | [string, string] | same as active | Hex stops for inactive notches when useGradient |
activeFill / inactiveFill | string | chart-1 / chart-background | Solid, CSS color, or url(#patternId) |
activeFillOpacity / inactiveFillOpacity | number | 1 / 0.8 | SVG fill-opacity (0–1) for active / track notches |
defaultLabel | string | "Total" | Center label |
formatOptions | ChartStatFlowFormat | standard | NumberFlow format |
prefix / suffix | string | - | Center prefix / suffix |
width / height | number | - | Fixed size; omit for responsive |
minWidth | number | 300 | Min width (px) when responsive |
className | string | - | Root wrapper |
children | ReactNode | - | Defs (Pattern*, *Gradient, …) |
Live examples
See the Gauge gallery. Use Studio to tune every gauge prop interactively and copy the resulting code.