GaugeChart

An arc that fills up to a value inside a range. Use it for one number that has a limit, such as CPU load, a score or progress to a goal.

General

Pass the value. The range is 0 to 100 unless you set min and max. Name it with aria-label.

Sections

With sections, the arc is split into bands. Each one ends at its value and starts where the one before ends.

Target and label

target draws a marker, such as a goal. label replaces the number in the center with anything.

Angles and size

startAngle and endAngle set the arc. 0 is the top and angles grow clockwise, so -90 to 90 is a half circle.

APIs

GaugeChart.Props

AttributeDescriptionTypeAccepted valuesDefault
valuethe value to shownumber--
minstart of the rangenumber-0
maxend of the rangenumber-100
sectionsbands of the arc, each one ends at its valueGaugeSection[]GaugeSection-
targetdraw a marker at this valuenumber--
sizewidth and height, in pixelsnumber-200
thicknesswidth of the arc, in pixelsnumber-14
startAnglewhere the arc starts, in degrees, 0 is the topnumber--120
endAnglewhere the arc ends, in degreesnumber-120
roundCapsround the ends of the arc, without sectionsboolean-false
typetheme color of the filled arc, without sectionsNormalTypes'default', 'primary', 'secondary', 'success', 'warning', 'error', 'info'primary
colorany CSS color for the filled arc, replaces typestring--
trackColorcolor of the unfilled arcstring-theme color
targetColorcolor of the target markerstring-theme color
labelcontent of the center, replaces the valueReactNode-the value
valueFormatterhow the value is written in the center(value: number) => string-thousands separators, en-US
...native props, passed to the rootHTMLAttributes'aria-label', 'className', ...-

GaugeSection

type GaugeSection = {
  value: number // where the band ends, it starts where the one before ends
  color?: string // any CSS color, a theme color when missing
}

Ref

The ref points at the root div.

Accessibility

With aria-label or aria-labelledby, the root is a meter that exposes the value, the range and the text written by valueFormatter. Without a name it is plain content, because a meter needs one.

The bands are only color, so write what the value means in the label or next to the gauge, such as "72 °C, warm".

Edit this page on GitHub