RecurringEntryTemplate
- Status
- Implemented
- Family
- 9 of 13
- Registry
- @lopifi/recurring-entry-template
npx shadcn@latest add @lopifi/theme @lopifi/recurring-entry-templateThe component, rendering
Real data, the shipped component. Switch the theme to check the claims the spec makes below.
The four-layer spec
Template plus schedule. Instances are source: "recurring" and read-only; the template is editable and edits apply forward only.
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/recurring-entry-template.tsx
- Lopifi dependencies · 9
- cnfiscal-periodformat-moneyiconsmoneymoney.typesrecurring-schedulestatus-pilltooltip
- npm packages
- @base-ui-components/reactclass-variance-authorityclsxtailwind-merge
- Registry entry
- /r/recurring-entry-template.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 { formatDate } from "@/lib/ledger/fiscal-period";
import type { MoneyValue } from "@/lib/ledger/money.types";
import { ArrowPathRoundedSquareIcon, LockClosedIcon } from "@/components/ledger/icons";
import { Money } from "@/components/ledger/money";
import { type Frequency, nextOccurrences } from "@/components/ledger/recurring-schedule";
import { StatusPill } from "@/components/ledger/status-pill";
export type RecurringInstance = {
id: string;
date: Date;
amount: MoneyValue;
posted: boolean;
};
export interface RecurringEntryTemplateProps {
amount: MoneyValue;
className?: string;
frequency: Frequency;
instances: RecurringInstance[];
name: string;
onEdit?: () => void;
startDate: Date;
}
/**
* The template is editable and edits apply **forward only**. Instances are
* `source: "recurring"` and read-only — editing a posted instance would
* silently detach it from the template that explains it.
*/
export function RecurringEntryTemplate({
name,
amount,
frequency,
startDate,
instances,
onEdit,
className,
}: RecurringEntryTemplateProps) {
const upcoming = nextOccurrences(startDate, frequency, 3);
return (
<div className={cn("rounded-xl border border-border bg-surface", className)}>
<header className="flex flex-wrap items-start justify-between gap-3 border-b border-border-subtle px-6 py-4">
<div>
<p className="flex items-center gap-2 text-body font-medium">
<ArrowPathRoundedSquareIcon aria-hidden="true" className="size-4 text-text-tertiary" />
{name}
</p>
<p className="text-caption text-text-secondary">
<Money size="xs" tone="inherit" value={amount} /> · {frequency} · started {formatDate(startDate)}
</p>
</div>
<button className="text-label font-medium text-accent hover:underline" onClick={onEdit} type="button">
Edit template
</button>
</header>
<section className="px-6 py-4">
<h3 className="text-label font-medium text-text-secondary">Upcoming</h3>
<ul className="mt-2 space-y-1">
{upcoming.map((d) => (
<li className="numeric text-body" key={d.toISOString()}>
{formatDate(d)}
</li>
))}
</ul>
</section>
<section className="border-t border-border-subtle px-6 py-4">
<h3 className="text-label font-medium text-text-secondary">Posted instances</h3>
<ul className="mt-2 space-y-1">
{instances.map((i) => (
<li className="flex items-center gap-3" key={i.id}>
<LockClosedIcon aria-label="Read-only" className="size-3 shrink-0 text-text-tertiary" />
<span className="numeric flex-1 text-body">{formatDate(i.date)}</span>
<StatusPill entity="Entry" status={i.posted ? "settled" : "scheduled"} />
<Money accounting value={i.amount} />
</li>
))}
</ul>
<p className="mt-2 text-caption text-text-tertiary">
Instances are read-only. Template edits apply forward only.
</p>
</section>
</div>
);
}
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.
- 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.
- 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
Elsewhere in the system
Where RecurringEntryTemplate 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.