CashFlowStatement
- Status
- Implemented
- Family
- 6 of 13
- Registry
- @lopifi/cash-flow-statement
npx shadcn@latest add @lopifi/theme @lopifi/cash-flow-statementThe component, rendering
Real data, the shipped component. Switch the theme to check the claims the spec makes below.
The four-layer spec
Operating / Investing / Financing, with the reconciliation to the change in cash. Supports both direct and indirect methods. The beginning-cash → ending-cash tie-out is displayed and asserted, same as the balance sheet's identity.
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/cash-flow-statement.tsx
- Lopifi dependencies · 14
- cncolumn-managerfiscal-periodformat-moneyiconsmoneymoney.typespercentperiod-changerulestatement-tabletooltipuse-scroll-edgesvariance-cell
- npm packages
- @base-ui-components/reactclass-variance-authorityclsxtailwind-merge
- Registry entry
- /r/cash-flow-statement.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 { cn } from "@/lib/ledger/cn";
import { CheckIcon, ExclamationTriangleIcon } from "@/components/ledger/icons";
import { Money } from "@/components/ledger/money";
import { type StatementHeader, type StatementLine, StatementTable } from "@/components/ledger/statement-table";
export interface CashFlowStatementProps {
className?: string;
/** Offer the period columns to hide. See `StatementTable`. */
columnManager?: boolean;
header: Omit<StatementHeader, "statement">;
lines: StatementLine[];
/** Caps the scroller so the column headers freeze. See `StatementTable`. */
maxHeight?: number;
method?: "indirect" | "direct";
periods: string[];
/** Beginning + net change = ending, and ending must equal the balance
sheet cash line. Asserted and displayed. */
tieOut: {
beginningCash: number[];
netChange: number[];
endingCash: number[];
balanceSheetCash: number[];
};
}
/**
* The working-capital sign convention is inverted and it confuses everyone:
* an *increase* in AR is a *use* of cash. The lines are labelled
* "(Increase) / decrease in …" exactly so, because the parenthetical is
* what makes the sign readable.
*/
export function CashFlowStatement({
header,
periods,
method = "indirect",
lines,
tieOut,
maxHeight,
columnManager,
className,
}: CashFlowStatementProps) {
return (
<div className={cn("w-full", className)}>
<StatementTable
columnManager={columnManager}
header={{
...header,
statement: `Statement of cash flows (${method} method)`,
}}
lines={lines}
maxHeight={maxHeight}
periods={periods}
/>
<div className="mt-4 space-y-2">
{periods.map((p, i) => {
const computed = tieOut.beginningCash[i] + tieOut.netChange[i];
const tiesInternally = computed === tieOut.endingCash[i];
const tiesToBalanceSheet = tieOut.endingCash[i] === tieOut.balanceSheetCash[i];
const ok = tiesInternally && tiesToBalanceSheet;
return (
<div
className={cn(
"flex flex-wrap items-center gap-2 rounded-md border px-4 py-3",
ok ? "border-positive bg-positive-subtle" : "border-negative bg-negative-subtle",
)}
key={p}
role={ok ? undefined : "alert"}
>
{ok ? (
<CheckIcon aria-hidden="true" className="size-4 shrink-0 text-positive" />
) : (
<ExclamationTriangleIcon aria-hidden="true" className="size-4 shrink-0 text-negative" />
)}
<span className="text-caption text-text-secondary">{p}:</span>
<span className="flex flex-wrap items-baseline gap-1 text-body">
Beginning{" "}
<Money accounting value={{ amount: tieOut.beginningCash[i], currency: header.currency }} />
<span aria-hidden="true">+</span>
Net change{" "}
<Money accounting value={{ amount: tieOut.netChange[i], currency: header.currency }} />
<span aria-hidden="true">=</span>
Ending{" "}
<Money accounting value={{ amount: tieOut.endingCash[i], currency: header.currency }} />
</span>
<span className={cn("text-body font-medium", ok ? "text-positive" : "text-negative")}>
{ok
? "Ties to the balance sheet cash line."
: tiesInternally
? "Does not tie to the balance sheet cash line."
: "Beginning plus net change does not equal ending cash."}
</span>
</div>
);
})}
</div>
</div>
);
}
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.
- Balance sheetAssets, liabilities and equity at a point in time, proving the accounting equation
- Cash flow statementWhere the cash went in a period, reconciled from net income
- Indirect methodPresenting operating cash flows by starting from net income and adjusting for non-cash items and changes in working capital — the method most entities use. ASC 230 also calls it the reconciliation method
- ReconciliationComparing our record to an external party's
- StatementP&L, balance sheet, or cash flow
- Tie-outProving a GL balance against supporting evidence
Also in Statements
- StatementTableThe shared shell: hierarchy, periods, rules.
- StatementRowIndent level, subtotal, total, expand.
- ProfitAndLossP&L with period comparison and variance.
- BalanceSheetAssets / liabilities / equity, with the balance check.
- 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
- Balance sheetAssets, liabilities and equity at a point in time, proving the accounting equationTerm
Elsewhere in the system
Where CashFlowStatement 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.
- CashFlowStatement, runningThe statements showcase — live, with theme, density, greyscale and reduced-motion switches.Live
- ReportsShould you build statements on the reports endpoints?API
- 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.