AllowanceRollForward
- Status
- Implemented
- Family
- 9 of 13
- Registry
- @lopifi/allowance-roll-forward
npx shadcn@latest add @lopifi/theme @lopifi/allowance-roll-forwardThe component, rendering
Real data, the shipped component. Switch the theme to check the claims the spec makes below.
The four-layer spec
Opening allowance → provision → write-offs → recoveries → closing, with the methodology displayed: "2% of current + 5% of 1–30 + 10% of 31–60 + 35% of 61–90 + 100% of 90+", each input traceable to the aging. Write-off and provision are named as distinct actions, because they have different P&L effects.
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/allowance-roll-forward.tsx
- Lopifi dependencies · 8
- cnformat-moneyiconsmoneymoney.typesroll-forwardruletooltip
- npm packages
- @base-ui-components/reactclass-variance-authorityclsxtailwind-merge
- Registry entry
- /r/allowance-roll-forward.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 { Money } from "@/components/ledger/money";
import { RollForward } from "@/components/ledger/roll-forward";
export type AllowanceMethodologyInput = {
bucket: string;
rate: number;
base: MoneyValue;
computed: MoneyValue;
};
export interface AllowanceRollForwardProps extends React.ComponentPropsWithoutRef<"div"> {
closing: MoneyValue;
glBalance: MoneyValue;
methodology: AllowanceMethodologyInput[];
opening: MoneyValue;
periodLabel: string;
/** Provision and write-off are named as distinct actions — they have
different P&L effects. */
provision: MoneyValue;
recoveries: MoneyValue;
writeOffs: MoneyValue;
}
/** The methodology is displayed, each input traceable to the aging. */
export const AllowanceRollForward = React.forwardRef<HTMLDivElement, AllowanceRollForwardProps>(
(
{
className,
periodLabel,
opening,
provision,
writeOffs,
recoveries,
closing,
glBalance,
methodology,
...props
},
ref,
) => (
<div className={cn("space-y-4", className)} ref={ref} {...props}>
<RollForward
additions={provision}
adjustments={recoveries}
closing={closing}
glBalance={glBalance}
opening={opening}
periodLabel={periodLabel}
releases={writeOffs}
title="Allowance for credit losses"
/>
<div className="rounded-xl border border-border bg-surface p-6">
<h3 className="text-title-sm font-medium">Methodology</h3>
<p className="mt-1 text-caption text-text-secondary">Each input traces to a bucket in the aging.</p>
<table className="mt-3 w-full">
<caption className="sr-only">Allowance methodology inputs</caption>
<thead>
<tr className="border-b border-border-subtle">
<th className="py-2 text-left text-label font-medium text-text-secondary" scope="col">
Bucket
</th>
<th className="py-2 text-right text-label font-medium text-text-secondary" scope="col">
Rate
</th>
<th className="py-2 text-right text-label font-medium text-text-secondary" scope="col">
Base
</th>
<th className="py-2 text-right text-label font-medium text-text-secondary" scope="col">
Allowance
</th>
</tr>
</thead>
<tbody>
{methodology.map((m) => (
<tr className="border-b border-border-subtle" key={m.bucket}>
<th className="py-2 text-left text-body font-normal" scope="row">
{m.bucket}
</th>
<td className="numeric py-2 text-right text-figure-sm">{m.rate}%</td>
<td className="py-2 text-right">
<Money accounting tone="secondary" value={m.base} />
</td>
<td className="py-2 text-right">
<Money accounting value={m.computed} />
</td>
</tr>
))}
</tbody>
</table>
<p className="mt-3 text-caption text-text-secondary">
{methodology.map((m) => `${m.rate}% of ${m.bucket}`).join(" + ")}
</p>
</div>
</div>
),
);
AllowanceRollForward.displayName = "AllowanceRollForward";
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 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.
- AccountTieOutEvery BS account, proven against its evidence.
- 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.
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
- P&LPerformance over a periodTerm
Elsewhere in the system
Where AllowanceRollForward 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.
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.