Delta
A signed change, with polarity and a redundant non-color cue.
npx shadcn add @lopifi/deltaExamples
The same component, case by case. Each stage is the shipped code with the props it shows; switch to Code for the usage.
Basis on hover
On a dense meta row the comparison basis moves into a tooltip — it is still stated, just not inline.
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.
A signed change. Never colored without a redundant cue.
<Delta value={{ amount: 12400, currency: "USD" }} percent={5.3} polarity="standard" />
// ↑ +$12,400.00 (+5.3%)
<Delta value={{ amount: 8200, currency: "USD" }} polarity="inverted" />
// ↑ +$8,200.00 ← colored NEGATIVE, because up is bad for this metric
interface DeltaProps {
value: MoneyValue | null;
percent?: PercentChange; // { kind: "points" | "relative"; value: number }
polarity: "standard" | "inverted" | "neutral"; // required, no default
showArrow?: boolean; // default true
showPercent?: boolean;
basis?: string; // "vs. Aug" — never omit the comparison basis
}
Polarity is the point. A -4.2% change in burn is good. Default everything to standard and the dashboard shows green on a cost overrun.
API change: polarity is now required and has no default (it previously fell back to standard). Callers that omitted it must choose: standard for revenue, cash and margin; inverted for cost, expense, DSO and burn; neutral for an FX rate or a headcount.
Structure: [arrow] [sign] [value] [(percent)] [basis]. The sign slot is reserved so a column of deltas aligns even when some are unchanged.
Zero delta: — with --neutral-value, no arrow. Not +0.0%.
Motion: none. Value flash when live.
The accounting it encodes
The concepts this component renders, each defined once in the lexicon.
More in Primitives
See also
Where this component is specified, defined and running.
Elsewhere in the system
The live section Delta renders in, the calculators behind its figures, and the ledger payloads that feed it.
- Delta, runningThe primitives showcase — live, with theme, density, grayscale and reduced-motion switches.
- Renewal uplift & notice dateWhat a renewal price increase costs over the contract, what capping it saves, and the last day to give notice.
- Unused seat costPaid seats against seats in use: what the idle ones cost a year, and what you save by right-sizing at renewal.
- Software spend per employeeTotal software spend turned into a yearly figure, a cost per person and a share of revenue, with what a trim is worth.
- PrimitivesBuild these first. Everything above them inherits their mistakes. Specs for 16 React components: Money, Delta, Figure, Percent and 12 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 Primitives changes
Your copy doesn’t update itself when we fix something here.
- One email when a Primitives component needs a migration
- Nothing when nothing changes
Or install it now