Metric Delta
A headline number with a change indicator that knows which direction is good.
- Data
- 1 file
- 1 npm package
- Accessibility notes
pnpm dlx @dowel-ui/cli add metric-deltanpm packages installed: class-variance-authority.
import { MetricDelta } from "@/components/ui/metric-delta";Default
Polarity Matters
Zero Baseline
Below The Noise Floor
No Comparison
Unchanged
Dashboard Row
Ai Evaluation
<MetricDelta>
| Prop | Type | Default |
|---|---|---|
label (required)Names the metric. | string | — |
value (required)The current value. | number | — |
comparisonLabelWhat the previous value represents, e.g. "vs last week". | string | "vs previous period" |
formatFormats the headline value. | (value: number) => string | defaultFormat |
insignificantBelowRelative change below which the delta is shown without sentiment, as a fraction. Presentation only — this is not a significance test. | number | 0 |
polarityWhether a rise is good news. Churn, latency, error rate and cost are all | MetricPolarity | "higher-is-better" |
previousThe value being compared against. Omit when there is nothing to compare. | number | — |
sampleSizeIncluded in the accessible description when given, so a reader can judge the change for themselves. Never used to compute significance. | number | — |
sentiment | "good" | "bad" | "neutral" | "neutral" |
Plus every attribute of <div> except children.
7/7
checks passed
- Tested — passes
- axe assertion — passes
- Keyboard tested — does not apply
- Storybook examples — passes
- Accessibility documented — passes
- Semantic tokens only — passes
- Motion from tokens — does not apply
- className merged — passes
- Visible focus — does not apply
- No fixed widths — passes