TransactionCard
- Status
- Implemented
- Family
- 5 of 13
- Registry
- @lopifi/transaction-card
npx shadcn@latest add @lopifi/theme @lopifi/transaction-cardThe component, rendering
Real data, the shipped component. Switch the theme to check the claims the spec makes below.
The four-layer spec
The mobile re-rank. 72px, 16px inset, full-bleed divider, amount right-aligned and never truncated, 32px mark, swipe-left actions with an overflow-menu equivalent because swipe is undiscoverable. Sticky date section headers.
Lifted verbatim from Ledger & tables. 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/transaction-card.tsx
- Lopifi dependencies · 21
- clipboardcncolumn-headerentity-markfiscal-periodformat-moneygroup-rowsiconsmoneymoney.typesreferencestatus-pilltable-sorttooltiptransaction-cardtransaction-tableuse-column-priorityuse-column-widthsuse-densityuse-grid-navuse-table-sort
- npm packages
- @base-ui-components/react@tanstack/react-virtualclass-variance-authorityclsxtailwind-merge
- Registry entry
- /r/transaction-card.json
The whole component
No compiled bundle, no black box. This is the file the registry copies, and the file you will edit.
"use client";
import { Checkbox } from "@base-ui-components/react/checkbox";
import { cn } from "@/lib/ledger/cn";
import { formatDateShort } from "@/lib/ledger/fiscal-period";
import { EntityMark } from "@/components/ledger/entity-mark";
import { CheckIcon, EllipsisHorizontalIcon } from "@/components/ledger/icons";
import { Money } from "@/components/ledger/money";
import { StatusPill } from "@/components/ledger/status-pill";
import type { Transaction } from "@/components/ledger/transaction-table";
export interface TransactionCardProps {
onOpen?: () => void;
onToggle?: () => void;
selected?: boolean;
transaction: Transaction;
}
/**
* The mobile re-rank, not a squeezed table row: 72px, 16px inset, full-bleed
* divider, 32px mark, amount right-aligned and never truncated.
*
* Swipe is undiscoverable, so the overflow menu is the equivalent and it is
* always present.
*/
export function TransactionCard({
transaction: t,
selected = false,
onToggle,
onOpen,
}: TransactionCardProps) {
return (
<li
className={cn(
"flex min-h-[72px] items-center gap-3 border-b border-border-subtle px-4 last:border-b-0",
selected && "bg-surface-selected",
// Pending is the warning rule and the "Pending" label, never a dimmed
// row: at 70% its secondary text fell to 3.2:1.
t.pending && "border-l-2 border-l-[var(--warning)]",
)}
>
{onToggle ? (
<Checkbox.Root
aria-label={`Select ${t.description}`}
checked={selected}
className="grid size-5 shrink-0 place-items-center rounded-xs border border-border-strong bg-surface data-[checked]:border-accent data-[checked]:bg-accent"
onCheckedChange={onToggle}
>
<Checkbox.Indicator className="text-accent-fg">
<CheckIcon className="size-3.5" />
</Checkbox.Indicator>
</Checkbox.Root>
) : null}
<EntityMark name={t.merchant ?? t.description} size={32} />
<button className="min-w-0 flex-1 py-3 text-left" onClick={onOpen} type="button">
<span className="block truncate text-body font-medium">{t.description}</span>
<span className="mt-0.5 block truncate text-caption text-text-secondary">
<span className="numeric">{formatDateShort(t.date)}</span> · {t.account}{" "}
<span className="reference-numeric">••{t.accountLast4}</span>
</span>
{t.status !== "settled" ? (
<span className="mt-1 inline-block">
<StatusPill entity="Transaction" status={t.status} />
</span>
) : null}
</button>
<div className="flex shrink-0 flex-col items-end gap-1">
<Money accounting colorBySign value={t.amount} />
<button
aria-label={`Actions for ${t.description}`}
className="press grid size-8 place-items-center rounded-sm text-text-tertiary hover:bg-surface-hover"
type="button"
>
<EllipsisHorizontalIcon aria-hidden="true" className="size-4" />
</button>
</div>
</li>
);
}
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 Ledger & tables
- TransactionTableThe workhorse. Virtualized, sticky, priority-collapsing.
- TransactionRowDesktop row.Spec
- TransactionDetailFull detail sheet with attachments and audit trail.
- LedgerTableDouble-entry with debit/credit columns and a balance check.
- AgingTableAR/AP buckets, 0-30-60-90+.
- ReconciliationViewTwo-pane matcher. The match animation.
- CategoryPickerHierarchical with rule creation.
- FilterBarURL-param-backed filters with resolved-value chips.
- BulkActionBarSelection count + actions, safe-area aware.
- ColumnManagerShow/hide/reorder with drag.
- GroupPickerOne cut through a table, with subtotals per group.
- ExportMenuCSV/XLSX/PDF with a stated scope.
- TableColumnsSort and resize for a table that renders on the server.
- ColumnHeaderThe sortable, draggable header cell.
- PeriodGridThe ruled grid. Frozen panes, hidden columns, hover change, ⌘C.
See also
A component is specified in one place, defined in another, and running in a third. All three, from here.
- Ledger & tables — the family specThe four-layer specification this component was built against, before it was written.Doc
- Ledger tables and transaction registersThe family running, with real figures in it, in both themes and at every density.Live
- CatalogAll 179 components, specified before they are written.Doc
- TransactionA business event — a payment, a sale, a purchaseTerm
Elsewhere in the system
Where TransactionCard 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.
- TransactionCard, runningThe tables showcase — live, with theme, density, greyscale and reduced-motion switches.Live
- Ledger & tablesThe table is the product. It gets the same design investment as the hero card. Specs for 15 React components: TransactionTable, TransactionRow, TransactionCard, TransactionDetail and 11 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 Ledger & tables 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.