Saltar al contenido principal

Gauge

Every example on this page is live, drawn by the library's Storybook, where you can also change its props and see the result.

A semicircular gauge with a needle that displays a value within a range, optionally divided into patterned zones.

Import​

import { Gauge } from "~lib/data-display/gauge";

Props​

NameTypeRequiredDefaultDescription
valuenumberYesN/ACurrent value to display
minnumberNo0Minimum scale value
maxnumberNo100Maximum scale value
labelstringNoN/ALabel shown below the value
showValuebooleanNotrueWhether to render the numeric value
unitstringNoN/AUnit set smaller after the value, such as "°C"
zones{ end: number; pattern: PatternType; label?: string }[]NoN/AQualitative arc zones, each labelled outside the arc when it has a label
widthnumber | stringNo100%Container width
heightnumber | stringNo100%Container height

Examples​

Simple​

Abrir Simple en Storybook

With a Unit​

Add a unit to set it smaller after the value, and keep label for the name of what is measured.

Abrir With Unit en Storybook

With Zones​

Abrir With Zones en Storybook

Labelled Bands​

Give each zone a label to name it around the outside of the arc. For a scale of whole-number bands, such as an air quality index from 1 to 5, set min and max half a step beyond the ends so each value lands in the middle of its band.

Abrir Air Quality Bands en Storybook
Abrir Zone Labels Without Label en Storybook

No Value​

Abrir No Value en Storybook

Custom Range​

Abrir Custom Range en Storybook

Negative Range​

Abrir Negative Range en Storybook

Single Zone​

Abrir Single Zone en Storybook

At Minimum​

Abrir At Minimum en Storybook

See Also​