SubscriptionCard
- Status
- Implemented
- Family
- 2 of 13
- Registry
- @lopifi/subscription-card
npx shadcn@latest add @lopifi/theme @lopifi/subscription-cardThe component, rendering
Real data, the shipped component. Switch the theme to check the claims the spec makes below.
The four-layer spec
Vendor mark, amount, cadence, next charge, annualized cost. Annualized is the useful number — $49/mo is $588/yr, and showing it is what makes a spend review actionable.
Lifted verbatim from Cards. The doc and this page are the same paragraphs, so they cannot disagree.
What lands in your repository
One component is never one file. Everything below is copied into your project, where you own it.
- Files
components/ledger/subscription-card.tsx
- Lopifi dependencies · 9
- cardcnentity-markfiscal-periodformat-moneyiconsmoneymoney.typestooltip
- npm packages
- @base-ui-components/reactclass-variance-authorityclsxtailwind-merge
- Registry entry
- /r/subscription-card.json
The whole component
No compiled bundle, no black box. This is the file the registry copies, and the file you will edit.
import * as React from "react";
import { cn } from "@/lib/ledger/cn";
import { formatDate } from "@/lib/ledger/fiscal-period";
import type { MoneyValue } from "@/lib/ledger/money.types";
import { Card } from "@/components/ledger/card";
import { EntityMark } from "@/components/ledger/entity-mark";
import { Money } from "@/components/ledger/money";
export interface SubscriptionCardProps extends React.ComponentPropsWithoutRef<"div"> {
amount: MoneyValue;
/** Computed by the caller — components never do arithmetic. */
annualized: MoneyValue;
cadence: "monthly" | "quarterly" | "annual";
nextCharge: Date;
vendor: string;
vendorSrc?: string;
}
/**
* The annualized figure is the useful number. $49/mo is $588/yr, and showing
* it is what makes a spend review actionable.
*/
export const SubscriptionCard = React.forwardRef<HTMLDivElement, SubscriptionCardProps>(
({ className, vendor, vendorSrc, amount, cadence, nextCharge, annualized, ...props }, ref) => (
<Card className={cn("flex items-center gap-3", className)} inset="compact" ref={ref} {...props}>
<EntityMark category="merchant" name={vendor} size={40} src={vendorSrc} />
<div className="min-w-0 flex-1">
<p className="truncate text-body font-medium">{vendor}</p>
<p className="text-caption text-text-secondary">Next {formatDate(nextCharge)}</p>
</div>
<div className="text-right">
<Money size="md" value={amount} />
<p className="text-caption text-text-secondary">
<span className="numeric">
<Money size="xs" tone="inherit" value={annualized} />
</span>{" "}
/ year
</p>
<p className="sr-only">{cadence}</p>
</div>
</Card>
),
);
SubscriptionCard.displayName = "SubscriptionCard";
The accounting it encodes
Concepts this component renders. Each one is defined once, in the lexicon, and used identically in the code and the copy.
Also in Cards
- BalanceCardThe hero: one trusted number.
- KpiCardMetric + delta + optional sparkline.
- AccountCardBank account with available vs. current.
- PaymentMethodCardThe physical card object. 3D flip, pointer tilt.
- RunwayCardMonths of runway with a burn line.
- InvoiceCardInvoice summary with aging state.
- AnomalyCardA flagged deviation with its explanation.
- GoalCardTarget vs. actual with a progress rule.
- StatCardThe minimal label+value card.Spec
See also
A component is specified in one place, defined in another, and running in a third. All three, from here.
- Cards — the family specThe four-layer specification this component was built against, before it was written.Doc
- Balance, KPI and account cardsThe family running, with real figures in it, in both themes and at every density.Live
- CatalogAll 179 components, specified before they are written.Doc
- BillA claim against usTerm
Elsewhere in the system
Where SubscriptionCard sits in the rest of the system — the live section it renders in, the calculators that compute what it displays, and the ledger payloads it is fed from.
- SubscriptionCard, runningThe cards showcase — live, with theme, density, greyscale and reduced-motion switches.Live
- CardsAll cards: 24px radius, 24px inset, --surface on --canvas, 1px --border, no resting shadow. Specs for 10 React components: BalanceCard, KpiCard, AccountCard, PaymentMethodCard and 6 more.Doc
Components are copied into your repository and meant to be edited — rounding policy, fiscal calendar and compliance copy differ per company.
Told when Cards changes
Components are copied into your repo, so a fix here does not reach you on its own. One email when a component in this family changes in a way that needs a migration — and nothing when it does not.