JournalEntryTable
- Status
- Implemented
- Family
- 9 of 13
- Registry
- @lopifi/journal-entry-table
npx shadcn@latest add @lopifi/theme @lopifi/journal-entry-tableThe component, rendering
Real data, the shipped component. Switch the theme to check the claims the spec makes below.
The four-layer spec
All entries, filterable by period, source, account, dimension, actor. Gapless-numbering check surfaced as a banner when a gap exists.
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/journal-entry-table.tsx
- Lopifi dependencies · 10
- accounting.typescnfiscal-periodformat-moneyiconsmoneymoney.typesreferencetooltipuse-scroll-edges
- npm packages
- @base-ui-components/reactclass-variance-authorityclsxtailwind-merge
- Registry entry
- /r/journal-entry-table.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 * as React from "react";
import { useScrollEdges } from "@/hooks/ledger/use-scroll-edges";
import type { EntrySource, JournalEntryRecord } from "@/lib/ledger/accounting.types";
import { cn } from "@/lib/ledger/cn";
import { formatDateShort } from "@/lib/ledger/fiscal-period";
import type { MoneyValue } from "@/lib/ledger/money.types";
import { ExclamationTriangleIcon } from "@/components/ledger/icons";
import { Money } from "@/components/ledger/money";
import { Reference } from "@/components/ledger/reference";
export interface JournalEntryTableProps extends React.ComponentPropsWithoutRef<"div"> {
entries: (JournalEntryRecord & { total: MoneyValue })[];
/** Caps the scroller so the header and the entry column can freeze. */
maxHeight?: number;
/** Most tax regimes require sequence; a gap is an audit finding. */
numberingGaps?: string[];
onOpen?: (entry: JournalEntryRecord) => void;
}
const SOURCES: EntrySource[] = [
"manual",
"adjusting",
"recurring",
"subledger",
"schedule",
"elimination",
"translation",
"import",
];
export function JournalEntryTable({
className,
entries,
numberingGaps = [],
onOpen,
maxHeight = 520,
...props
}: JournalEntryTableProps) {
const scroller = useScrollEdges<HTMLDivElement>();
const [source, setSource] = React.useState<EntrySource | "all">("all");
const filtered = source === "all" ? entries : entries.filter((e) => e.source === source);
return (
<div className={cn("space-y-3", className)} {...props}>
{numberingGaps.length > 0 ? (
<p
className="flex items-center gap-2 rounded-sm bg-negative-subtle px-3 py-2 text-body text-negative"
role="alert"
>
<ExclamationTriangleIcon aria-hidden="true" className="size-4 shrink-0" />
Entry numbering has {numberingGaps.length} gap
{numberingGaps.length === 1 ? "" : "s"} ({numberingGaps.join(", ")}). Sequence is required, and a
gap is an audit finding.
</p>
) : null}
<label className="inline-flex items-center gap-2">
<span className="text-label font-medium text-text-secondary">Source</span>
<select
className="h-8 rounded-sm border border-border bg-surface px-2 text-label outline-none focus-visible:border-accent focus-visible:ring-2 focus-visible:ring-accent-subtle"
onChange={(e) => setSource(e.target.value as EntrySource | "all")}
value={source}
>
<option value="all">All</option>
{SOURCES.map((s) => (
<option className="capitalize" key={s} value={s}>
{s}
</option>
))}
</select>
</label>
<div
className="ledger-frozen scrollbar-thin rounded-xl border border-border bg-surface"
ref={scroller}
style={{ maxHeight }}
>
<table className="w-full min-w-[720px]">
<caption className="sr-only">Journal entries</caption>
<thead>
<tr className="border-b border-border-subtle">
{["Entry", "Date", "Description", "Source", "Status", "Amount"].map((h, i) => (
<th
className={cn(
"px-3 py-3 text-label font-medium text-text-secondary",
i === 5 ? "text-right" : "text-left",
i === 0 && "pl-6",
i === 5 && "pr-6",
)}
data-frozen={i === 0 ? "left" : undefined}
key={h}
scope="col"
>
{h}
</th>
))}
</tr>
</thead>
<tbody>
{filtered.map((e) => (
<tr
className="border-b border-border-subtle transition-colors duration-1 ease-standard hover:bg-surface-hover"
key={e.id}
>
<td className="py-3 pl-6 pr-3" data-frozen="left">
<button className="text-left" onClick={() => onOpen?.(e)} type="button">
<Reference copyable={false} truncate={false} value={e.entryNumber} />
</button>
</td>
<td className="numeric px-3 py-3 text-figure-sm text-text-secondary">
{formatDateShort(e.date)}
</td>
<th
className="max-w-0 truncate px-3 py-3 text-left text-body font-normal"
data-frozen="none"
scope="row"
>
{e.description}
</th>
<td className="px-3 py-3 text-caption capitalize text-text-secondary">{e.source}</td>
<td className="px-3 py-3 text-caption capitalize text-text-secondary">{e.status}</td>
<td className="py-3 pl-3 pr-6 text-right">
<Money accounting value={e.total} />
</td>
</tr>
))}
</tbody>
</table>
</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.
Also in Accounting core (GL)
- JournalEntryDebit and credit as two columns. No signed-column variant.
- JournalEntryFormLine grid with live balance check and dimension capture.
- 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.
- 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
- DimensionA non-account axis: entity, department, projectTerm
Elsewhere in the system
Where JournalEntryTable 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.
- JournalEntryTable, runningThe gl showcase — live, with theme, density, greyscale and reduced-motion switches.Live
- Journal entry balancerPaste an entry, see the out-of-balance, and copy an import-ready CSV.Tool
- Journals and the general ledgerCan you get the actual general ledger out?API
- 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.