Compact Breakdown
A total split into its parts in one small card, with rank changes shown.
PROGet Compact Breakdown and 168 other Pro components with pro lifetime — Get Pro
- Category
- Data & feedback
- Access
- ProPro · unlocked
- Source
- 434 lines · one file
- States
- 5 drawn
- Added
- 21 Oct 2026
The decision inside it
It shows rank moves, not only the new order
A row that changed places carries "↑2" or "↓1", a screen reader hears "up from #3 to #1", and the footer names the biggest climb in words.
When to use it
Use Compact Breakdown for one total split into its parts in a small card, with a 7d / 30d / 90d switch and rank moves shown (↑2). Pass the parts for each period with their previous values. For a chart over time use Breakdown Chart.
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 Compact Breakdown for this.
Install it: npx shadcn@latest add @liro/compact-breakdown
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/compact-breakdown.
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 { CompactBreakdown, type BreakdownPart } from "@/components/ui/compact-breakdown";
const usd = (v: number) => v.toLocaleString("en-US", { style: "currency", currency: "USD", maximumFractionDigits: 0 });
export function ChannelCard({ data }: { data: Record<string, BreakdownPart[]> }) {
return <CompactBreakdown title="Revenue by channel" noun="revenue" data={data} defaultPeriod="30d" format={usd} />;
}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 | ||
|---|---|---|---|
title | React.ReactNode | No | – |
noun | string | No | What the total measures, used in sentences: "revenue", "orders". |
data | Record<string, BreakdownPart[]> | Yes | Parts for each period, keyed by period value. |
periods | BreakdownPeriod[] | No | – |
period | string | No | – |
defaultPeriod | string | No | – |
onPeriodChange | (period: string) => void | No | – |
format | (v: number) => string | No | – |
goodWhen | "up" | "down" | No | Which direction is good news. Default "up". |
maxRows | number | No | Rows before "Show n more". Default 6. |
Dependencies
npm packages
clsxframer-motionlucide-reacttailwind-mergeLiro foundations, installed alongside it
liro-themesegmented-controlStates
All of them are drawn by the component. None is left for you to design.
- 30 days
- Period switch
- Rank climb
- Long list
- Empty period
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