Skip to main content

Arc Gauge

A filled arc gauge that sweeps from min to max. Uses a colored fill instead of a needle — the fill arc grows as the value increases.

Playground

info

onZoneChange callbacks work in your local project but not in this interactive playground due to how the editor re-renders components.

Props

PropTypeDefaultDescription
dataRelayDataPointRequired. { value, timestamp, isLoading?, error? }
minnumber0Minimum scale value
maxnumber100Maximum scale value
labelstringLabel text centered inside the arc
unitstringUnit suffix (e.g., "%")
formatValuefunctionCustom value formatter: (value) => string
alertZonesAlertZone[]Color zones rendered at 25% opacity on the arc
showZoneValuesbooleanfalseShow boundary values on zone edges
stylesobjectCustom styling — see Styles
showLastUpdatedbooleanfalseShow the timestamp from data.timestamp
formatTimestampfunctionCustom timestamp formatter: (ts) => string
showLoadingbooleantrueShow skeleton shimmer while loading
onZoneChangefunctionCalled when value enters a new zone — see onZoneChange
onErrorfunctionCalled on invalid data — see onError

How It Differs from NeedleGauge

NeedleGaugeArcGauge
VisualRotating needleFilled arc sweep
Default fill color#374151 (grey)#3b82f6 (blue)
Zone opacity100%25%
Arc thickness14px20px
Value positionBelow the arcCentered inside the arc
Default value font size22px26px

Styles

styles={{
value: { fontSize: 26, fontWeight: 700, color: "#1e293b", fontFile: "/fonts/Custom.woff2" },
label: { fontSize: 14, color: "#64748b" },
unit: { fontSize: 12, color: "#94a3b8" },
minMax: { fontSize: 10, color: "#94a3b8" },
lastUpdated: { fontSize: 10, color: "#94a3b8" },
background: { color: "#f8fafc" },
}}
FieldApplies toProperties
valueThe large numberfontFamily, fontSize, fontWeight, color, fontFile
labelThe label textfontFamily, fontSize, fontWeight, color, fontFile
unitThe unit suffixfontFamily, fontSize, fontWeight, color, fontFile
minMaxMin/max labelsfontFamily, fontSize, fontWeight, color, fontFile
lastUpdatedTimestamp textfontFamily, fontSize, fontWeight, color, fontFile
backgroundComponent bgcolor
FieldTypeDefaultDescription
arcThicknessnumber20Thickness of the gauge arc
arcAnglenumber180Sweep angle in degrees (30–300)
widthnumberFixed width override
heightnumberFixed height override

With Hooks

import { useRelayLatest, ArcGauge } from "@relay-x/ui";

function HumidityGauge() {
const latest = useRelayLatest({
deviceIdent: "sensor_01",
metric: "humidity",
timeRange: { start: Date.now() - 86400000, end: Date.now() },
});

return <ArcGauge data={latest} min={0} max={100} label="Humidity" unit="%" />;
}