Block 248 of 297
Gauge Meter
A semicircle gauge with up to three named bands, showing the value and its band as text.
- Puck key
- GaugeMeterBlock
- Export
- gaugeMeterBlock
- React component
- <GaugeMeter />
- Path
- components/puck/gauge-meter-block.tsx
- Dependencies
- None
- License
- MIT
About this block
When to use it, how to write for it, and what to change in the code.
What it's for
A semicircle gauge for one value, with the number and its band name printed inside the arc and the scale ends underneath. One or two breakpoints split the scale into named bands such as Low, Moderate and High, listed in a legend below. Bands can use green, amber and red status colors or brand shades. Value, scale and breakpoints are text fields that accept {{ source.field }} bindings.
- Shelter or facility occupancy against capacity
- Air quality, water level or other readings with defined ranges
- Budget spent against an annual allocation
Writing the content
- Set Scale minimum and Scale maximum; blank means 0 and 100.
- Enter one or two Band breakpoints, like 60, 85. Values outside the scale are ignored, and the Middle band label is used only with two breakpoints.
- Choose Better when the value is Low for occupancy or wait times, so the low band shows green.
- Write band labels as plain statements, like "Beds available", since the current one appears as a badge under the number.
Accessibility
- The gauge SVG has role="img" and an aria-label that states the value, the scale and the current band.
- The current band name is printed as text and marked "(current)" in the legend for screen readers, so status never depends on color (WCAG 1.4.1).
- The title can be an H2 to H4 or plain text.
Customizing the code
- Status colors are in the STATUS map and brand shades in the BRAND array, both as Tailwind stroke classes.
- The arc radius and center are the R, CX and CY constants; the value stroke width is 14.
Editor fields
What content editors see in the P1 sidebar when they select this block.
- Titletext
- Heading levelselect
- Period or subtitletext
- Valuetext
- Scale minimumtext
- Scale maximumtext
- Unittext
- Band breakpointstext
- Low band labeltext
- Middle band labeltext
- High band labeltext
- Better when the value isradio
- Band colorsradio
- Footnotetext