Skip to content

AllowanceRollForward

With the methodology shown, not just the number.
Implemented
Status
Implemented
Family
9 of 13
Registry
@lopifi/allowance-roll-forward
npx shadcn@latest add @lopifi/theme @lopifi/allowance-roll-forward

The component, rendering

Real data, the shipped component. Switch the theme to check the claims the spec makes below.

Preview

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.

components/ledger/allowance-roll-forward.tsx
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)

See also

A component is specified in one place, defined in another, and running in a third. All three, from here.

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.

One address, no list rental, unsubscribe in one click.

Works in your QuickBooks Online or Xero file

Get your books closed every month

Lopifi is building AI bookkeeping that keeps your books closed on US GAAP as transactions happen, with a CPA review every quarter, for $200 a month. We’re not open yet.

$200/month when we open. No card now.