GitHubGitHub
← All widgets
Data display / widget

Gauge

A 240-degree SVG gauge with automatic nice bounds, explicit range overrides, threshold markers, target, animated live value, and window statistics.

NormalWarningCriticalNo dataOver range

CPU load

normal
warning: 80critical: 92Target 700100
Min71.4
Max78.4
Avg75.66
<Gauge label="CPU load" value={78.4} min={0} max={100} unit="%" thresholds={limits} target={70} />

Installation

pnpm add @chanrg/4ui

Import the stylesheet once, at the root of your app:

import '@chanrg/4ui/styles.css';

Usage

import { Gauge } from '@chanrg/4ui';<Gauge label="CPU load" value={78.4} min={0} max={100} unit="%" thresholds={limits} target={70} />

API reference

Props

PropTypeDefaultDescription
valuenumber | nullnullCurrent reading.
min / maxnumber | nullautomaticOptional explicit scale bounds; otherwise derived from points.
targetnumber | nullnullTarget marker on the arc.
thresholdsGaugeThreshold[][]Warning and critical markers.
pointsArray<number | null>[]Observed values used for auto-ranging and statistics.

CSS variables

VariableDescription
--4ui-surfacePrimary component surface.
--4ui-textPrimary foreground color.
--4ui-borderDefault control and panel border.

Accessibility

  • The SVG accessible name includes value, range, unit, and status.
  • Threshold and target markers include text alternatives.

Dependencies

4ui numeric normalization helper