StatementRow
- Status
- Implemented
- Family
- 6 of 13
- Registry
- @lopifi/statement-row
npx shadcn@latest add @lopifi/theme @lopifi/statement-rowThe component, rendering
Real data, the shipped component. Switch the theme to check the claims the spec makes below.
The four-layer spec
One line. Indent level, label, N period values, expand toggle, subtotal/total variant, drill-down affordance.
Server-safe (no "use client") — a 400-row statement renders on the server. This is why Money, Rule, and StatementRow are all RSC-compatible; it's a real performance decision, not a purity one.
Lifted verbatim from Statements. 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/statement-row.tsx
- npm packages
- @base-ui-components/reactclass-variance-authorityclsxtailwind-merge
- Registry entry
- /r/statement-row.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, StatementRowVariant } from "@/lib/ledger/money.types";
import { Money } from "@/components/ledger/money";
export interface StatementRowProps extends React.ComponentPropsWithoutRef<"tr"> {
expandable?: boolean;
expanded?: boolean;
label: string;
level?: number;
onToggle?: () => void;
values: (MoneyValue | null)[];
variant?: StatementRowVariant;
}
/**
* One line. Server-safe (no `"use client"`) — a 400-row statement renders on
* the server, which is why `Money`, `Rule` and this component all stay RSC-
* compatible. That is a performance decision, not a purity one.
*/
export const StatementRow = React.forwardRef<HTMLTableRowElement, StatementRowProps>(
(
{ className, label, level = 1, variant = "line", values, expandable, expanded, onToggle, ...props },
ref,
) => {
const emphasized = variant === "subtotal" || variant === "total";
const accessibleLabel =
variant === "total" ? `${label}, grand total` : variant === "subtotal" ? `${label}, subtotal` : label;
return (
<tr
className={cn("border-b border-border-subtle", className)}
data-row-variant={variant}
ref={ref}
{...props}
>
<th
className={cn(
"py-3 pr-4 text-left font-normal",
emphasized && "font-medium",
variant === "section" && "text-title-sm font-medium",
)}
data-level={level}
scope="row"
style={{ paddingLeft: 24 + 24 * (level - 1) }}
>
{expandable ? (
<button
aria-expanded={expanded}
className="mr-1 text-text-tertiary"
onClick={onToggle}
type="button"
>
{expanded ? "−" : "+"}
</button>
) : null}
{accessibleLabel}
</th>
{values.map((v, i) => (
<td className="px-3 py-3 text-right" key={i}>
{variant === "section" ? null : (
<Money accounting size={variant === "total" ? "md" : "sm"} statement value={v} />
)}
</td>
))}
</tr>
);
},
);
StatementRow.displayName = "StatementRow";
export { Rule } from "@/components/ledger/rule";
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 Statements
- StatementTableThe shared shell: hierarchy, periods, rules.
- ProfitAndLossP&L with period comparison and variance.
- BalanceSheetAssets / liabilities / equity, with the balance check.
- CashFlowStatementOperating / investing / financing.
- StatementToolbarBasis, period, comparison, currency, consolidation.
- PeriodPickerFiscal-aware. Never assumes January.
- VarianceCellAbsolute + percent + significance flag.
- FluxAnalysisPeriod-over-period explanations.
- DrilldownSheetStatement line → the GL entries behind it.
- TrialBalanceAll accounts with the debit=credit proof.
- CloseChecklistTasks, owners, blockers, sign-off.
See also
A component is specified in one place, defined in another, and running in a third. All three, from here.
- Statements — the family specThe four-layer specification this component was built against, before it was written.Doc
- Financial statement componentsThe 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 StatementRow 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.
- StatementRow, runningThe statements showcase — live, with theme, density, greyscale and reduced-motion switches.Live
- StatementsThe largest gap in the market. No component library ships a <BalanceSheet />. This family is the reason Lopifi exists. Specs for 12 React components: StatementTable, StatementRow, ProfitAndLoss, BalanceSheet and 8 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 Statements 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.