Skip to content

Block 265 of 297

Metric Grid

Up to nine small stats with changes in one dense card for an at-a-glance overview.

Puck key
MetricGridBlock
Export
metricGridBlock
React component
<MetricGrid />
Path
components/puck/metric-grid-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

Up to nine small stats in one card, separated by hairlines, each with a label, a value and an optional change arrow. Choose two or three columns for wide cards; narrow cards stack to one column, then two. Empty cells fill out the last row so the grid stays even. Values accept {{ source.field }} bindings.

  • A monthly "at a glance" panel for a library or parks system
  • A dense summary at the top of a board report
  • Secondary stats beside a large KPI card
Writing the content
  • Pick 3 columns for six or nine metrics and 2 for four or eight, so the rows come out full.
  • Value is shown as written, so you can use short forms like 48.2k.
  • Enter Change (%) as a bare number; set An increase is to Bad for things like hold wait times.
  • Changes compared with prints once under the grid and is also read with each change.
Accessibility
  • Each cell is a description list pairing its label and value, so screen readers announce them together.
  • Changes include hidden Up or Down, better or worse, and the comparison, alongside the arrow, so color is not the only cue (WCAG 1.4.1).
  • The filler cells that square off the last row are aria-hidden.
Customizing the code
  • Column breakpoints are the @2xs:grid-cols-2 and @lg:grid-cols-3 container classes on the grid.
  • Change colors are text-emerald-700 and text-red-700 in the tone constant.

Editor fields

What content editors see in the P1 sidebar when they select this block.

  • Titletext
  • Heading levelselect
  • Subtitle or periodtext
  • Metricsarray
  • Columns (wide cards)radio
  • Changes compared withtext
  • Footnotetext