AccountTieOut
- Status
- Implemented
- Family
- 9 of 13
- Registry
- @lopifi/account-tie-out
npx shadcn@latest add @lopifi/theme @lopifi/account-tie-outThe component, rendering
Real data, the shipped component. Switch the theme to check the claims the spec makes below.
The four-layer spec
The balance-sheet walk-down: GL balance vs. supporting schedule closing balance, difference, supporting evidence, reviewer, and date. Every balance sheet account gets one. An account with no supporting evidence renders an explicit "Unsupported" state rather than nothing.
Lifted verbatim from Accounting core (GL). 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/account-tie-out.tsx
- Lopifi dependencies · 9
- cnfiscal-periodformat-moneyfrozen-labeliconsmoneymoney.typestooltipuse-scroll-edges
- npm packages
- @base-ui-components/reactclass-variance-authorityclsxtailwind-merge
- Registry entry
- /r/account-tie-out.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 { useScrollEdges } from "@/hooks/ledger/use-scroll-edges";
import { cn } from "@/lib/ledger/cn";
import { formatDate } from "@/lib/ledger/fiscal-period";
import { FROZEN_LABEL } from "@/lib/ledger/frozen-label";
import type { MoneyValue } from "@/lib/ledger/money.types";
import { CheckIcon, DocumentMagnifyingGlassIcon, ExclamationTriangleIcon, PaperClipIcon } from "@/components/ledger/icons";
import { Money } from "@/components/ledger/money";
export type TieOutRow = {
accountNumber: string;
accountName: string;
glBalance: MoneyValue;
/** null means there is no supporting schedule at all. */
scheduleBalance: MoneyValue | null;
evidence?: { name: string; hash: string };
reviewer?: string;
reviewedAt?: Date;
};
export interface AccountTieOutProps extends React.ComponentPropsWithoutRef<"div"> {
asOfLabel: string;
/**
* Caps the scroller so the header and the account column can freeze. Without a
* height the page scrolls instead and there is nothing for the frozen
* header to stick to.
*/
maxHeight?: number;
rows: TieOutRow[];
}
/**
* The balance-sheet walk-down. **Every balance sheet account gets one.**
* An account with no supporting evidence renders an explicit "Unsupported"
* state rather than nothing — nothing reads as fine.
*/
export const AccountTieOut = React.forwardRef<HTMLDivElement, AccountTieOutProps>(
({ className, rows, asOfLabel, maxHeight = 520, ...props }, ref) => {
const scroller = useScrollEdges<HTMLDivElement>();
const unsupported = rows.filter((r) => r.scheduleBalance === null);
const breaks = rows.filter(
(r) => r.scheduleBalance !== null && Number(r.scheduleBalance.amount) !== Number(r.glBalance.amount),
);
return (
<div className={cn("space-y-3", className)} ref={ref} {...props}>
<div className="flex flex-wrap gap-2">
<Chip
label={`${breaks.length} account${breaks.length === 1 ? "" : "s"} out of tie`}
tone={breaks.length === 0 ? "positive" : "negative"}
/>
<Chip
label={`${unsupported.length} unsupported`}
tone={unsupported.length === 0 ? "positive" : "warning"}
/>
</div>
<div className="rounded-xl border border-border bg-surface">
<div className="px-6 pb-4 pt-6">
<p className="text-title-sm font-medium">Balance sheet account tie-out</p>
<p className="text-caption text-text-secondary">{asOfLabel}</p>
</div>
<div className="ledger-frozen scrollbar-thin" ref={scroller} style={{ maxHeight }}>
<table className="w-full min-w-[860px]">
<caption className="sr-only">Balance sheet account tie-out. {asOfLabel}</caption>
<thead>
<tr className="border-b border-border-subtle">
{["Account", "GL balance", "Schedule", "Difference", "Evidence", "Reviewed"].map((h, i) => (
<th
className={cn(
"px-3 py-3 text-label font-medium text-text-secondary",
i >= 1 && i <= 3 ? "text-right" : "text-left",
i === 0 && `pl-6 ${FROZEN_LABEL}`,
i === 5 && "pr-6",
)}
key={h}
scope="col"
>
{h}
</th>
))}
</tr>
</thead>
<tbody>
{rows.map((r) => {
/* Held as a value rather than a boolean so the null check
narrows the type for every use below it. */
const scheduleBalance = r.scheduleBalance;
const unsupportedRow = scheduleBalance === null;
const difference = scheduleBalance
? Number(r.glBalance.amount) - Number(scheduleBalance.amount)
: null;
const ties = difference === 0;
return (
<tr
className={cn(
"border-b border-border-subtle",
!unsupportedRow && !ties && "bg-negative-subtle",
unsupportedRow && "bg-warning-subtle",
)}
key={r.accountNumber}
>
<th
className="sticky left-0 z-sticky bg-[inherit] shadow-[1px_0_0_var(--border-subtle)] py-3 pl-6 pr-3 text-left font-normal"
scope="row"
>
<span className="reference-numeric text-caption text-text-tertiary">
{r.accountNumber}
</span>{" "}
<span className="text-body">{r.accountName}</span>
</th>
<td className="px-3 py-3 text-right">
<Money accounting value={r.glBalance} />
</td>
<td className="px-3 py-3 text-right">
{scheduleBalance === null ? (
<span className="inline-flex items-center gap-1 text-caption text-warning">
<DocumentMagnifyingGlassIcon aria-hidden="true" className="size-3.5" />
Unsupported
</span>
) : (
<Money accounting value={scheduleBalance} />
)}
</td>
<td className="px-3 py-3 text-right">
{difference === null ? (
<span className="numeric relative text-figure-sm text-text-tertiary">
<span aria-hidden="true">n/a</span>
<span className="sr-only select-none">not available</span>
</span>
) : (
<span
className={cn(
"inline-flex items-center gap-1",
ties ? "text-positive" : "text-negative",
)}
>
{ties ? (
<CheckIcon aria-hidden="true" className="size-3.5" />
) : (
<ExclamationTriangleIcon aria-hidden="true" className="size-3.5" />
)}
<Money
accounting
tone="inherit"
value={{ amount: difference, currency: r.glBalance.currency }}
/>
</span>
)}
</td>
<td className="px-3 py-3 text-left">
{r.evidence ? (
<span className="inline-flex items-center gap-1 text-caption text-text-secondary">
<PaperClipIcon aria-hidden="true" className="size-3" />
{r.evidence.name}
</span>
) : (
<span className="text-caption text-warning">None attached</span>
)}
</td>
<td className="py-3 pl-3 pr-6 text-left text-caption text-text-secondary">
{r.reviewer && r.reviewedAt ? (
<>
{r.reviewer}
<span className="block text-text-tertiary">{formatDate(r.reviewedAt)}</span>
</>
) : (
<span className="text-warning">Not reviewed</span>
)}
</td>
</tr>
);
})}
</tbody>
</table>
</div>
</div>
</div>
);
},
);
AccountTieOut.displayName = "AccountTieOut";
function Chip({ tone, label }: { tone: "positive" | "negative" | "warning"; label: string }) {
return (
<span
className={cn(
"rounded-sm px-2 py-1 text-caption font-medium",
tone === "positive" && "bg-positive-subtle text-positive",
tone === "negative" && "bg-negative-subtle text-negative",
tone === "warning" && "bg-warning-subtle text-warning",
)}
>
{label}
</span>
);
}
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.
- AccountA GL account in the chart of accounts. Always qualify when a bank account is meant.
- Balance sheetAssets, liabilities and equity at a point in time, proving the accounting equation
- EvidenceDocumentation supporting a recorded amount
- General ledgerThe complete set of accounts, holding every posted entry
- Tie-outProving a GL balance against supporting evidence
Also in Accounting core (GL)
- JournalEntryDebit and credit as two columns. No signed-column variant.
- JournalEntryFormLine grid with live balance check and dimension capture.
- JournalEntryTableAll entries, with the gapless-numbering check.
- AccountPickerShows the normal balance. Blocks non-postable accounts.
- ChartOfAccountsHierarchy, statement mapping, unsupported-account flags.
- AccountRegisterGL detail with a running balance.
- DimensionPickerEntity always required; renders what the account demands.
- AdjustingEntryFormTemplated by type. Auto-reverse defaults on for accruals.
- RecurringEntryTemplateTemplate editable; instances read-only.
- EntryReversalDialogHold-to-confirm. Never a delete.
- ScheduleTableOne shell, seven presets. Prepaids through debt.
- RollForwardOpening → movements → closing → tie. The universal shape.
- SchedulePreviewWhat the schedules will post, before they post.
- RevenueWaterfallDeferred balance recognizing by future period.
- DepreciationScheduleBook and tax in parallel. In-service date, not purchase date.
- LeaseScheduleROU asset and liability on diverging curves.
- AllowanceRollForwardWith the methodology shown, not just the number.
See also
A component is specified in one place, defined in another, and running in a third. All three, from here.
- Accounting core (GL) — the family specThe four-layer specification this component was built against, before it was written.Doc
- General ledger and accounting coreThe family running, with real figures in it, in both themes and at every density.Live
- CatalogAll 179 components, specified before they are written.Doc
- AccountA GL account in the chart of accounts. Always qualify when a bank account is meant.Term
Elsewhere in the system
Where AccountTieOut 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.
- AccountTieOut, runningThe gl showcase — live, with theme, density, greyscale and reduced-motion switches.Live
- Difference diagnoserOut by 8,100? That is divisible by 9 — a transposition. This says which error fits the gap.Tool
- Trial balance checkerBalances — and then the harder question: is anything sitting on the wrong side of its normal?Tool
- Accounting core (GL)The general ledger layer. Specs for 18 React components: JournalEntry, JournalEntryForm, JournalEntryTable, AccountPicker and 14 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 Accounting core (GL) 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.