Paper
A printable A4 or Letter sheet: margins, repeated header and footer, page breaks.
import { Paper, PageBreak, printPaper, paperSize } from "@forgeron/ui";Atelier Exemple
Invoice
INV-2026-0042
Sent
From
Atelier Exemple
1 Test Street
00000 Sampletown
Bill to
Client Exemple
2 Sample Avenue
00000 Sampletown
| Line | Description | Qty | Unit price | Tax % | Disc. % | Amount |
|---|---|---|---|---|---|---|
| 1 | Design workshop | 2 day | €850.00 | 20 % | €1,700.00 | |
| 2 | Printed booklet | 40 pcs | €12.50 | 5.5 % | 10 % | €450.00 |
- Subtotal
- €2,200.00
- Discounts
- -€50.00
- Total excluding tax
- €2,150.00
- Tax 5.5 %
- on €450.00€24.75
- Tax 20 %
- on €1,700.00€340.00
- Total
- €2,514.75
- Amount paid
- -€200.00
- Balance due
- €2,314.75
import {
Button,
DocumentHeader,
LineItemsEditor,
MetaTable,
Paper,
PartyBlock,
StatusBadge,
TotalsSummary,
printPaper,
type LineItem,
} from "@forgeron/ui";
import { useRef } from "react";
const lines: LineItem[] = [
{
id: "a",
description: "Design workshop",
quantity: 2,
unit: "day",
unitPrice: 85000,
taxRate: 20,
},
{
id: "b",
description: "Printed booklet",
quantity: 40,
unit: "pcs",
unitPrice: 1250,
taxRate: 5.5,
discount: 10,
},
];
export default function Invoice() {
const sheet = useRef<HTMLDivElement>(null);
return (
<div style={{ display: "grid", gap: 12, width: "100%" }}>
<div>
<Button
size="sm"
onClick={() => {
const el = sheet.current?.querySelector<HTMLElement>(".fg-paper");
if (el) printPaper(el, "Invoice INV-2026-0042");
}}
>
Print
</Button>
</div>
<div ref={sheet}>
<Paper
label="Invoice INV-2026-0042"
footer="Atelier Exemple · 1 Test Street · Payment within 30 days"
>
<DocumentHeader
title="Invoice"
number="INV-2026-0042"
brand={<strong>Atelier Exemple</strong>}
status={<StatusBadge status="sent" />}
/>
<div className="fg-paper-parties">
<PartyBlock
label="From"
name="Atelier Exemple"
lines={["1 Test Street", "00000 Sampletown"]}
/>
<PartyBlock
label="Bill to"
name="Client Exemple"
lines={["2 Sample Avenue", "00000 Sampletown"]}
/>
</div>
<MetaTable
rows={[
{ label: "Issued", value: "2026-11-19" },
{ label: "Due", value: "2026-12-19" },
]}
/>
<LineItemsEditor value={lines} currency="EUR" locale="en" readOnly />
<div style={{ alignSelf: "flex-end", width: 280 }}>
<TotalsSummary lines={lines} currency="EUR" locale="en" paid={20000} />
</div>
</Paper>
</div>
</div>
);
}API → Props
| Prop | Type | Default | Description |
|---|---|---|---|
size | "A4" | "Letter" | "A4" | Millimetres, as printed. |
landscape | boolean | false | Turns the sheet. |
margin | string | "18mm" | A CSS length; also the @page margin. |
header / footer | ReactNode | — | Repeated on every printed page. |
zoom | "fit" | number | "fit" | On screen only: the sheet shrinks to its container. Printing is 1. |
guides | boolean | true | Lines where a page ends. |
pageRule | boolean | true | Writes `@page` for the size. One Paper per printed document. |
printPaper(element, title?) | function | — | Prints one element alone through a hidden frame that copies the page's styles. |
className | string | — | Extra classes. |