Change Summary
What moved since last time, one metric per row, biggest change first.
PROGet Change Summary and 168 other Pro components with pro lifetime — Get Pro
- Category
- Data & feedback
- Access
- ProPro · unlocked
- Source
- 307 lines · one file
- States
- 6 drawn
- Added
- 21 Oct 2026
The decision inside it
Good is decided per metric
Churn going up is red and revenue going up is green, so the colour answers "is this good news?". Rows sort by the size of the change, so a 30% drop in sign-ups is never hidden under metrics that moved a rounding error.
When to use it
Use Change Summary for what moved since last time, as sentences: each metric decides whether up is good (goodWhen), rows sort by the size of the change, and small moves read as steady. For KPI tiles with charts use the chart components.
Installation
How you get it
Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.
Use Liro's Change Summary for this.
Install it: npx shadcn@latest add @liro/change-summary
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/change-summary.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @liro registry with your CLI token: see the Namespaced tab.
Usage
import { ChangeSummary, type ChangeMetric } from "@/components/ui/change-summary";
const usd = (v: number) => v.toLocaleString("en-US", { style: "currency", currency: "USD", maximumFractionDigits: 0 });
const metrics: ChangeMetric[] = [
{ id: "mrr", label: "MRR", value: 48210, previous: 44900, format: usd },
{ id: "churn", label: "Churn", value: 2.6, previous: 2.1, goodWhen: "down", delta: "absolute", format: (v) => `${v}%`, formatDelta: (d) => `${d.toFixed(1)} pts` },
{ id: "signups", label: "Sign-ups", value: 1284, previous: 1281 },
];
export function WeeklyChanges() {
return <ChangeSummary since="Last week" metrics={metrics} />;
}API reference
“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Type | Notes | ||
|---|---|---|---|
metrics | ChangeMetric[] | Yes | – |
since | string | No | The comparison point: "Last week", "Last visit". |
sinceDetail | string | No | A longer note under the title: "Tuesday 14 Oct, 3 days ago". |
title | React.ReactNode | No | – |
sort | "change" | "given" | No | "change" (default) sorts the biggest movement first; "given" keeps your order. |
flatBelow | number | No | A relative change below this counts as steady. Default 0.005 (0.5%). |
onSelect | (id: string) => void | No | Makes each row a button. |
Dependencies
npm packages
clsxframer-motionlucide-reacttailwind-mergeLiro foundations, installed alongside it
liro-themeStates
All of them are drawn by the component. None is left for you to design.
- Mixed
- Good news
- Bad news
- Steady
- New metric
- Nothing moved
Accessibility
- Keyboard reachable throughout, in visual order
- Focus trapped in overlays, Escape closes them
- Focus returns to whatever opened it
- Live regions announce what changed, not that something did
- Honours prefers-reduced-motion
Responsive behavior
- Sizes to its container, not the viewport
- Usable from 320px up
- Pointer-based interaction, so trackpad and touch both work
- No hover-only affordances