Skip to content

ReceiptSheet

Printable/shareable receipt.
Implemented
Status
Implemented
Family
3 of 13
Registry
@lopifi/receipt-sheet
npx shadcn@latest add @lopifi/theme @lopifi/receipt-sheet

The component, rendering

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

Preview

The four-layer spec

Printable and shareable. Entity, amount, payee, method, reference, timestamp with timezone. Print styles are first-class — this is a document people keep.

Lifted verbatim from Payments. 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/receipt-sheet.tsx

Lopifi dependencies · 9
cnfiscal-periodformat-moneyiconsmoneymoney.typesreferenceruletooltip
npm packages
@base-ui-components/reactclass-variance-authorityclsxtailwind-merge
Registry entry
/r/receipt-sheet.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/receipt-sheet.tsx
import * as React from "react";
import { cn } from "@/lib/ledger/cn";
import { formatTimestamp } from "@/lib/ledger/fiscal-period";
import type { MoneyValue } from "@/lib/ledger/money.types";
import { Money } from "@/components/ledger/money";
import { Reference } from "@/components/ledger/reference";
import { Rule } from "@/components/ledger/rule";

export interface ReceiptSheetProps extends React.ComponentPropsWithoutRef<"article"> {
  amount: MoneyValue;
  at: Date;
  entity: string;
  lines?: { label: string; amount: MoneyValue }[];
  method: string;
  payee: string;
  reference: string;
  timeZone?: string;
}

/**
 * A document people keep. Print styles are first-class, and nothing here is
 * abbreviated.
 */
export const ReceiptSheet = React.forwardRef<HTMLElement, ReceiptSheetProps>(
  (
    { className, entity, amount, payee, method, reference, at, timeZone = "UTC", lines = [], ...props },
    ref,
  ) => (
    <article
      className={cn("rounded-xl border border-border bg-surface p-6 print:border-0", className)}
      ref={ref}
      {...props}
    >
      <header className="border-b border-border-subtle pb-4">
        <p className="font-display text-title-md">{entity}</p>
        <p className="text-caption text-text-secondary">Payment receipt</p>
      </header>

      <dl className="mt-4 space-y-2">
        <Row label="Paid to">{payee}</Row>
        <Row label="Method">{method}</Row>
        <Row label="Reference">
          <Reference truncate={false} value={reference} />
        </Row>
        <Row label="Date">
          <span className="numeric">{formatTimestamp(at, timeZone)}</span>
        </Row>
      </dl>

      {lines.length > 0 ? (
        <table className="mt-4 w-full">
          <tbody>
            {lines.map((l) => (
              <tr key={l.label}>
                <th className="py-1 text-left text-body font-normal text-text-secondary" scope="row">
                  {l.label}
                </th>
                <td className="py-1 text-right">
                  <Money accounting value={l.amount} />
                </td>
              </tr>
            ))}
          </tbody>
        </table>
      ) : null}

      <div className="mt-4">
        <Rule className="ml-auto w-1/2" variant="subtotal" />
        <div className="flex items-baseline justify-between pt-2">
          <span className="text-label font-medium">Total paid</span>
          <Money accounting size="md" value={amount} />
        </div>
        <Rule className="ml-auto mt-1 w-1/2" variant="total" />
      </div>
    </article>
  ),
);
ReceiptSheet.displayName = "ReceiptSheet";

function Row({ label, children }: { label: string; children: React.ReactNode }) {
  return (
    <div className="flex items-baseline justify-between gap-6">
      <dt className="text-body text-text-secondary">{label}</dt>
      <dd className="text-right text-body">{children}</dd>
    </div>
  );
}

Also in Payments

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 ReceiptSheet 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 Payments 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.