GoalCard
- Status
- Implemented
- Family
- 2 of 13
- Registry
- @lopifi/goal-card
npx shadcn@latest add @lopifi/theme @lopifi/goal-cardThe component, rendering
Real data, the shipped component. Switch the theme to check the claims the spec makes below.
The four-layer spec
Target vs. actual with a progress rule (a rule line, not a rounded progress bar — consistent with the statement grammar).
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/goal-card.tsx
- npm packages
- @base-ui-components/reactclass-variance-authorityclsxtailwind-merge
- Registry entry
- /r/goal-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 type { MoneyValue } from "@/lib/ledger/money.types";
import { Card } from "@/components/ledger/card";
import { Money } from "@/components/ledger/money";
import { Percent } from "@/components/ledger/percent";
export interface GoalCardProps extends React.ComponentPropsWithoutRef<"div"> {
actual: MoneyValue;
label: string;
/** Computed by the caller. */
progressPercent: number;
target: MoneyValue;
}
/**
* The progress indicator is a rule line, not a rounded bar — consistent with
* the statement grammar rather than borrowed from a generic UI kit.
*/
export const GoalCard = React.forwardRef<HTMLDivElement, GoalCardProps>(
({ className, label, actual, target, progressPercent, ...props }, ref) => {
const clamped = Math.max(0, Math.min(100, progressPercent));
return (
<Card className={cn("flex flex-col gap-3", className)} ref={ref} {...props}>
<span className="text-label font-medium text-text-secondary">{label}</span>
<div className="flex items-baseline justify-between gap-3">
<Money size="lg" value={actual} />
<span className="text-caption text-text-secondary">
of <Money size="xs" tone="inherit" value={target} />
</span>
</div>
<div
aria-label={`${label} progress`}
aria-valuemax={100}
aria-valuemin={0}
aria-valuenow={Math.round(clamped)}
className="relative h-[3px] w-full bg-border-subtle"
role="progressbar"
>
<div className="absolute inset-y-0 left-0 bg-accent" style={{ width: `${clamped}%` }} />
</div>
<Percent signed={false} value={{ kind: "relative", value: progressPercent }} />
</Card>
);
},
);
GoalCard.displayName = "GoalCard";
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.
- SubscriptionCardRecurring charge with next-billing.
- AnomalyCardA flagged deviation with its explanation.
- 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
- StatementP&L, balance sheet, or cash flowTerm
Elsewhere in the system
Where GoalCard 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.
- GoalCard, 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.