Change Summary
Each metric as a sentence ("Up 7.4% to $48,210", "Steady at 1,284") with a small tinted arrow and an optional trend line. Rates can report the change in points, new metrics say so, and a row can become a button to drill in.
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 Layro's Change Summary for this.
Install it: npx shadcn@latest add @layro/change-summary
(the @layro registry is set up in components.json, with LAYRO_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 @layro 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.
| Prop | Type | Notes |
|---|---|---|
metricsrequired | ChangeMetric[] | — |
since | string | The comparison point: "Last week", "Last visit". |
sinceDetail | string | A longer note under the title: "Tuesday 14 Oct, 3 days ago". |
title | React.ReactNode | — |
sort | "change" | "given" | "change" (default) sorts the biggest movement first; "given" keeps your order. |
flatBelow | number | A relative change below this counts as steady. Default 0.005 (0.5%). |
onSelect | (id: string) => void | Makes each row a button. |
Dependencies
npm packages
clsxframer-motionlucide-reacttailwind-mergeLayro foundations, installed alongside it
layro-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
Used in a screenAll screens
Lifetime access
Every component, and everything we ship next.
- All 232 components, source included
- Every template, and everything released after you buy
- shadcn CLI or download — React 18/19, Tailwind v4
- One payment. No subscription.