Skip to content
Design System
GitHub

Metric card

v0.19.0Beta

One headline number on a card: label, value, change and context, coloured only when the change is for the worse; a link, loading and unavailable state, and MetricGrid for the row.

API reference

Generated from the types. Every part also takes className.

MetricCard

Also takes every prop of <div> (except children).

labelrequired
ReactNodeWhat is counted: "Robots online". The link's text when the card has href.
value
ReactNodeThe number, already formatted: "12", "1,204", "99.2".
unit
stringWritten small after the value: "/ 14", "h", "%".
delta
stringChange against the previous period: "+8%", "−2". A leading minus (- or −) turns the arrow down; no change ("0", "±0 %") has no arrow.
trend
"flat" | "good" | "bad" = "flat"Whether the change is good. Direction alone does not decide: a rise in events is bad. Only "bad" is coloured.
series
number[]Last values, oldest first, drawn as a sparkline: beside the value from 640 px, under it on a phone. Two or more.
caption
ReactNodeOne line of context under the value: "2 docked for charging", "Last 7 days".
href
stringMakes the whole card one link, to the page behind the number.
linkAs
ElementType = "a"Your router's link (e.g. next/link), for href.
loading
boolean = falseThe value is on its way: the label stays, bones hold the value and caption at the same height.
unavailable
stringWhy there is no value ("Device offline since 14:02"). The value shows a dash and this replaces the caption.
labels
MetricCardLabelsThe words only screen readers hear (", better", ", worse", "Loading", "Not available"), to translate them.

Other parts

  • MetricGrid takes every prop of <div>.