KpiCard
Metric + delta + optional sparkline.
npx shadcn add @lopifi/kpi-cardExamples
The same component, case by case. Each stage is the shipped code with the props it shows; switch to Code for the usage.
Inverted polarity
A falling cost line is good news; inverted polarity keeps the fall from reading red.
Unknown, not zero
Before the period is closed the figure is unknown, and the card says so instead of printing $0.00.
How it behaves
What it renders, what it refuses to render, and why. The same paragraphs as the family spec, so the two can’t disagree.
Label · figure · delta · optional sparkline. The dashboard atom.
- Baselines align across a
KpiRow. Usegridwithauto-rows-frand a shared figure row, or two cards with different label lengths put their figures at different heights. It's the most visible alignment failure on a dashboard. - Display family forbidden here. Figures align across the row.
polarityis required, with no default, to force the decision.- The comparison basis is always shown:
vs. Aug, never a bare+5.3%.
Loading: skeleton with the figure block at the exact figure width, or the card jumps when data lands.
More in Cards
See also
Where this component is specified, defined and running.
Elsewhere in the system
The live section KpiCard renders in, the calculators behind its figures, and the ledger payloads that feed it.
- KpiCard, runningThe cards showcase — live, with theme, density, grayscale and reduced-motion switches.
- Margin & markupMargin is profit over price; markup is profit over cost. Solve either way.
- CardsAll cards: 24px radius, 24px inset, --surface on --canvas, 1px --border, no resting shadow. Specs for 11 React components: BalanceCard, KpiCard, AccountCard, PaymentMethodCard and 7 more.
Components are copied into your repository and meant to be edited. Rounding policy, fiscal calendar and compliance copy differ per company.
Release notes
Get an email when Cards changes
Your copy doesn’t update itself when we fix something here.
- One email when a Cards component needs a migration
- Nothing when nothing changes
Or install it now