Metric
A KPI tile with trend direction, invertible "good" semantics and a decorative sparkline.
Live preview
Source
The exact file rendered in the preview above.
components/demos/metric.tsx
components/ui/metric.tsx
Demo source — adapt to your project. Foundry is not published as a package.
Usage
For a single number that matters. `invertTrend` exists because a rise is not automatically good — latency and error rate going up is a regression, and the component should not colour it green.
- The delta carries an arrow, a sign and a colour, so direction survives greyscale.
- Sparklines are decorative and hidden from assistive tech; the number beside them is the content.
- Keep labels short — a metric label that wraps to two lines is a description, not a label.
Variants and states
Every entry below is a genuine difference in behaviour or layout, and every one of them is visible in the preview above.
- Card and plain
- With delta
- Inverted trend — for churn and latency
- With sparkline
Accessibility
- Semantics
- Rendered as a description list so the label and value are programmatically paired.
- Sparkline
- The SVG is `aria-hidden`; it adds shape, not information.
Foundry implements published ARIA patterns and is tested against them. No WCAG certification is claimed — see the accessibility documentation for what is and is not covered.
Related
All componentsProgress
Determinate and indeterminate progress as a bar or a ring, with four tones.
starter5 variantsCard
A discrete record in a collection, with five tones and a composable header, title, description and footer.
starterFeatured6 variantsDashboard metric row
Four KPI tiles, two of them with inverted trend semantics.
starterFeatured3 variants