Money
The core primitive. A monetary value, formatted correctly.
npx shadcn add @lopifi/moneyExamples
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 core primitive. Every monetary value in the system renders through it.
<Money value={{ amount: 124056, currency: "USD" }} /> // $1,240.56
<Money value={{ amount: -124056, currency: "USD" }} accounting /> // ($1,240.56)
<Money value={null} /> // n/a
<Money value={{ amount: 0, currency: "USD" }} statement /> // —
interface MoneyProps extends React.ComponentPropsWithoutRef<"span"> {
value: MoneyValue | null;
/** parentheses for negatives (statements/tables) vs. a leading − (deltas) */
accounting?: boolean;
/** em dash for a true zero — statements only */
statement?: boolean;
size?: "xs" | "sm" | "md" | "lg" | "hero";
/** subordinate the symbol; default true */
showSymbol?: boolean;
/** show the ISO code — required in mixed-currency contexts */
showCode?: boolean;
/** mark as converted: renders "≈" and requires a rate for the tooltip */
approximate?: { rate: number; asOf: Date; from: string };
/** "$1.2M" via abbreviateMoney (never below 10K) — charts and KPIs only;
the exact value stays in the spoken label and the title */
compact?: boolean;
redacted?: boolean;
locale?: string;
}
Layer 3 — structure: [≈] [symbol] [integer] [.decimals] [code] — five slots, four optional. The paren column is reserved on both sides regardless of sign.
Layer 4 — type: one size, one weight. tnum + case always. Symbol and code at --text-tertiary; decimals at --text-tertiary only at lg/hero.
Motion: none, except the value flash when live and the crossfade when the value changes from a user action. Never interpolates.
Edge cases: JPY 0dp · KWD 3dp · bigint amounts · negative zero (renders as zero) · the widest-plausible-value width reservation · aria-label announcing the sign in words.
Why it matters: if this is wrong, everything is wrong. The rest of the library assumes the case/tnum/paren-alignment work done here.
More in Primitives
See also
Where this component is specified, defined and running.
Elsewhere in the system
The live section Money renders in, the calculators behind its figures, and the ledger payloads that feed it.