BalanceCard
The hero: one trusted number.
npx shadcn add @lopifi/balance-cardExamples
The same component, case by case. Each stage is the shipped code with the props it shows; switch to Code for the usage.
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.
The hero: one trusted number, and the reason a user opens the product.
Layer 1: radius 24 · inset 24 · min-width 280 · height auto
Layer 2:
┌─ 24 ─────────────────────────────────┐
│ [eyebrow] · [account mark] │ ← row, space-between
│ 8 │
│ [figure] │
│ 8 │
│ [delta] · [as-of] │
│ 16 │
├─ full-bleed sparkline ───────────────┤ ← optional, bleeds to 3 edges
└──────────────────────────────────────┘
Layer 3: eyebrow (1 line, truncate) · figure (never truncates) · delta (1 line) · media (aspect-[4/1], full-bleed) · actions (max 2)
Layer 4:
| Slot | Token | Weight | Color |
|---|---|---|---|
| eyebrow | label 13/16 |
500 | --text-secondary |
| figure | figure-hero 40/48 |
500 | --text-primary |
| delta | caption 12/16 |
400 | semantic |
3 sizes, 2 weights ✓
Available vs. current. A bank balance has two values and they differ. Show available as the figure, and current as a secondary line when they diverge. Mixing them up is the costliest copy error in consumer banking UI.
Polarity: required, no default. standard for a cash or asset balance, inverted for a card or credit line, where up means more owed. (API change: it previously fell back to standard.)
Motion: none at rest. Value flash when live. Sparkline draws once. Interactive variant gets press scale(0.97) and a 1px hover lift.
Responsive: figure steps 40 → 28 below a 280px container. Sparkline drops below 240px.
Edge cases: negative balance (overdraft — parens and a --negative figure, plus an explicit "Overdrawn" pill) · redacted · stale (dim to 0.7 + StaleIndicator) · very long account name.
The accounting it encodes
The concepts this component renders, each defined once in the lexicon.
More in Cards
See also
Where this component is specified, defined and running.
Elsewhere in the system
The live section BalanceCard renders in, the calculators behind its figures, and the ledger payloads that feed it.
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