Blocks Design System

Invoice

A design studio’s invoice as one Server Component: sender and recipient addresses, the invoice number and dates, a status Badge, the services in a Table with quantity, rate and amount, totals aligned to the right, and payment instructions. Print and Download PDF are Buttons rendered as links.

Northfold StudioProduct design for field teams

Invoice

Unpaid · due Dec 18
Field app redesign, phase 2
Billed to

Cedar Creek Watershed Council
Attn: Dana Whitfield
88 River Road
Tacoma, WA 98402

From

Northfold Studio LLC
412 Alder Street, Suite 3
Bellingham, WA 98225
billing@northfold.example

Invoice no.
INV-2026-0142
Issued
Due
Services for INV-2026-0142
DescriptionQtyRateAmount
Discovery workshops
Two on-site days with field staff
2 days$1,800.00$3,600.00
Interface design
Offline note-taking and sync flows
46 hrs$150.00$6,900.00
Usability testing
Eight sessions, recruiting included
8 sessions$425.00$3,400.00
Design system handoff
Tokens, component specs and a walkthrough
1 package$2,400.00$2,400.00
Subtotal
$16,300.00
Sales tax (9%)
$1,467.00
Total due
$17,767.00

Payment

ACH or wire to Harbor Valley Credit Union, account ending 4821. Use INV-2026-0142 as the reference. Net 30; a 1.5% monthly fee applies after the due date.

Notes

Thank you, Dana. Phase 3 kicks off January 12; the statement of work follows by email this week.

Source · recipes/invoice.tsx
recipes/invoice.tsx
import {
  Badge,
  BodySmall,
  Button,
  Grid,
  Heading,
  Separator,
  Stack,
  Table,
  TableBody,
  TableCell,
  TableContainer,
  TableHead,
  TableHeader,
  TableRow,
  Text,
} from '@blocks/design-system'
import { Download, Mountain, Printer } from 'lucide-react'
import type { ReactNode } from 'react'
import styles from './invoice.module.css'

const lineItems = [
  { description: 'Discovery workshops', detail: 'Two on-site days with field staff', quantity: 2, unit: 'days', rate: 1800 },
  { description: 'Interface design', detail: 'Offline note-taking and sync flows', quantity: 46, unit: 'hrs', rate: 150 },
  { description: 'Usability testing', detail: 'Eight sessions, recruiting included', quantity: 8, unit: 'sessions', rate: 425 },
  { description: 'Design system handoff', detail: 'Tokens, component specs and a walkthrough', quantity: 1, unit: 'package', rate: 2400 },
]

const taxRate = 0.09
const money = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' })

// A printable invoice, rendered entirely on the server. Totals are computed
// from the line items; the module's print rules hide the actions and borders.
export default function Invoice() {
  const subtotal = lineItems.reduce((sum, item) => sum + item.quantity * item.rate, 0)
  const tax = subtotal * taxRate
  const total = subtotal + tax

  return (
    <article aria-labelledby="invoice-title" className={styles.sheet}>
      <Stack gap="xl">
        <Stack direction="row" justify="space-between" align="start" gap="lg" wrap="wrap">
          <Stack direction="row" gap="md" align="center">
            <span className={styles.mark}>
              <Mountain aria-hidden />
            </span>
            <Stack gap="none">
              <Text fontWeight="semibold">Northfold Studio</Text>
              <Text fontSize="sm" color="text-muted">
                Product design for field teams
              </Text>
            </Stack>
          </Stack>
          <Stack direction="row" gap="sm" dangerouslySetClassName={styles.actions}>
            <Button as="a" href="#invoice-print" size="sm">
              <Printer aria-hidden className={styles.icon} />
              Print
            </Button>
            <Button as="a" href="#invoice-pdf" size="sm" variant="primary">
              <Download aria-hidden className={styles.icon} />
              Download PDF
            </Button>
          </Stack>
        </Stack>

        <Stack gap="sm">
          <Stack direction="row" gap="md" align="center" wrap="wrap">
            <Heading as="h2" id="invoice-title" fontSize="xxl">
              Invoice
            </Heading>
            <Badge tone="warning">Unpaid · due Dec 18</Badge>
          </Stack>
          <Text color="text-muted">Field app redesign, phase 2</Text>
        </Stack>

        <Grid gap="lg" dangerouslySetClassName={styles.parties}>
          <Party title="Billed to">
            <Text fontWeight="semibold">Cedar Creek Watershed Council</Text>
            <br />
            Attn: Dana Whitfield
            <br />
            88 River Road
            <br />
            Tacoma, WA 98402
          </Party>
          <Party title="From">
            <Text fontWeight="semibold">Northfold Studio LLC</Text>
            <br />
            412 Alder Street, Suite 3
            <br />
            Bellingham, WA 98225
            <br />
            billing@northfold.example
          </Party>
          <dl className={styles.meta}>
            <div>
              <dt>Invoice no.</dt>
              <dd>INV-2026-0142</dd>
            </div>
            <div>
              <dt>Issued</dt>
              <dd>
                <time dateTime="2026-11-18">Nov 18, 2026</time>
              </dd>
            </div>
            <div>
              <dt>Due</dt>
              <dd>
                <time dateTime="2026-12-18">Dec 18, 2026</time>
              </dd>
            </div>
          </dl>
        </Grid>

        <TableContainer tabIndex={0} role="region" aria-labelledby="invoice-items-caption">
          <Table dangerouslySetClassName={styles.table}>
            <caption id="invoice-items-caption" className={styles.caption}>
              Services for INV-2026-0142
            </caption>
            <TableHeader>
              <TableRow>
                <TableHead scope="col">Description</TableHead>
                <TableHead scope="col" textAlign="right">
                  Qty
                </TableHead>
                <TableHead scope="col" textAlign="right">
                  Rate
                </TableHead>
                <TableHead scope="col" textAlign="right">
                  Amount
                </TableHead>
              </TableRow>
            </TableHeader>
            <TableBody>
              {lineItems.map((item) => (
                <TableRow key={item.description}>
                  <TableCell>
                    <Text fontWeight="medium">{item.description}</Text>
                    <br />
                    <Text fontSize="xs" color="text-muted">
                      {item.detail}
                    </Text>
                  </TableCell>
                  <TableCell textAlign="right">
                    {item.quantity} {item.unit}
                  </TableCell>
                  <TableCell textAlign="right">{money.format(item.rate)}</TableCell>
                  <TableCell textAlign="right">{money.format(item.quantity * item.rate)}</TableCell>
                </TableRow>
              ))}
            </TableBody>
          </Table>
        </TableContainer>

        <dl className={styles.totals} aria-label="Totals">
          <div>
            <dt>Subtotal</dt>
            <dd>{money.format(subtotal)}</dd>
          </div>
          <div>
            <dt>Sales tax ({taxRate * 100}%)</dt>
            <dd>{money.format(tax)}</dd>
          </div>
          <div className={styles.total}>
            <dt>Total due</dt>
            <dd>{money.format(total)}</dd>
          </div>
        </dl>

        <Separator />

        <Grid gap="lg" dangerouslySetClassName={styles.notes}>
          <Stack as="section" gap="xs" aria-labelledby="invoice-payment">
            <Heading as="h3" id="invoice-payment" fontSize="sm">
              Payment
            </Heading>
            <BodySmall margin="none" color="text-muted">
              ACH or wire to Harbor Valley Credit Union, account ending 4821. Use <span className={styles.nowrap}>INV-2026-0142</span> as the reference. Net 30; a 1.5%
              monthly fee applies after the due date.
            </BodySmall>
          </Stack>
          <Stack as="section" gap="xs" aria-labelledby="invoice-notes">
            <Heading as="h3" id="invoice-notes" fontSize="sm">
              Notes
            </Heading>
            <BodySmall margin="none" color="text-muted">
              Thank you, Dana. Phase 3 kicks off January 12; the statement of work follows by email this week.
            </BodySmall>
          </Stack>
        </Grid>
      </Stack>
    </article>
  )
}

function Party({ title, children }: { title: string; children: ReactNode }) {
  return (
    <Stack gap="xs">
      <Text fontSize="xs" fontWeight="semibold" color="text-muted">
        {title}
      </Text>
      <p className={styles.address}>{children}</p>
    </Stack>
  )
}
Invoice INV-2026-0142

How it works

  • Nothing here needs the client: the totals are computed from the line items while rendering, and the parts are imported by name (TableHead, TableCell), as a Server Component must.
  • Print and Download PDF link to routes the app serves, such as a print view and a generated PDF. The page prints well on its own too: the module’s @media print rules drop the buttons and the card’s border and shadow, and keep table rows and the totals from splitting across pages.
  • Every number uses tabular numerals and is right-aligned, so amounts line up by digit down the table and through the totals. When the sheet is under 30rem wide, a container query stacks each line: the description across the top, then quantity × rate on the left and the amount on the right, with the column headers kept for screen readers.
  • The invoice number and dates are a description list, with time elements carrying machine-readable dates.
  • Container queries put the parties in three columns from 34rem wide and stack them on a phone.

App-owned CSS

recipes/invoice.module.css
.sheet {
  container-type: inline-size;
  padding: var(--ds-space-lg);
  background-color: var(--ds-color-bg);
  border: var(--ds-border-width-sm) solid var(--ds-color-border-subtle);
  border-radius: var(--ds-border-radius-xl);
  box-shadow: var(--ds-shadow-sm);
}

@media (min-width: 40rem) {
  .sheet {
    padding: var(--ds-space-xl);
  }
}

.mark {
  display: grid;
  place-items: center;
  width: var(--ds-control-height-lg);
  height: var(--ds-control-height-lg);
  color: var(--ds-color-accent-fg);
  background-color: var(--ds-color-accent);
  border-radius: var(--ds-border-radius-md);

  & svg {
    width: var(--ds-icon-size-md);
    height: var(--ds-icon-size-md);
  }
}

.icon {
  width: var(--ds-icon-size-sm);
  height: var(--ds-icon-size-sm);
}

/* Parties and invoice details side by side once there's room. */
@container (min-width: 34rem) {
  .sheet .parties {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) max-content;
  }

  .sheet .notes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.address {
  margin: 0;
  font-size: var(--ds-font-size-sm);
  font-style: normal;
  line-height: var(--ds-line-height-body);
  overflow-wrap: anywhere;
}

.meta {
  display: grid;
  align-content: start;
  gap: var(--ds-space-sm);
  margin: 0;
  font-size: var(--ds-font-size-sm);

  & div {
    display: flex;
    justify-content: space-between;
    gap: var(--ds-space-md);
  }

  & dt {
    color: var(--ds-color-text-muted);
    white-space: nowrap;
  }

  & dd {
    margin: 0;
    font-weight: var(--ds-font-weight-medium);
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
  }
}

.nowrap {
  white-space: nowrap;
}

.caption {
  position: absolute;
  width: var(--ds-space-xxs);
  height: var(--ds-space-xxs);
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Numbers line up by digit in every column and in the totals. */
.table {
  font-variant-numeric: tabular-nums;

  & td {
    padding-block: var(--ds-space-md);
    vertical-align: top;
  }

  & td:not(:first-child) {
    white-space: nowrap;
  }
}

/* On a narrow sheet each line stacks: the description on top, then
   "2 days × $1,800.00" on the left and the amount on the right. */
@container (max-width: 30rem) {
  .sheet .table,
  .sheet .table tbody {
    display: block;
  }

  .sheet .table thead {
    position: absolute;
    width: var(--ds-space-xxs);
    height: var(--ds-space-xxs);
    overflow: hidden;
    clip-path: inset(50%);
  }

  .sheet .table tr {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    column-gap: var(--ds-space-sm);
    padding-block: var(--ds-space-md);
  }

  .sheet .table td {
    padding: 0;
    text-align: left;
  }

  .sheet .table td:first-child {
    grid-column: 1 / -1;
    margin-bottom: var(--ds-space-xs);
  }

  .sheet .table td:nth-child(3)::before {
    content: "× ";
  }

  .sheet .table td:last-child {
    font-weight: var(--ds-font-weight-semibold);
    text-align: right;
  }
}

.totals {
  display: grid;
  gap: var(--ds-space-sm);
  width: 100%;
  max-width: var(--ds-measure-sm);
  margin: 0 0 0 auto;
  font-size: var(--ds-font-size-sm);
  font-variant-numeric: tabular-nums;

  & div {
    display: flex;
    justify-content: space-between;
    gap: var(--ds-space-lg);
  }

  & dt {
    color: var(--ds-color-text-muted);
  }

  & dd {
    margin: 0;
    text-align: right;
  }
}

.total {
  padding-top: var(--ds-space-md);
  font-size: var(--ds-font-size-lg);
  font-weight: var(--ds-font-weight-bold);
  border-top: var(--ds-border-width-md) solid var(--ds-color-text);

  & dt {
    color: var(--ds-color-text);
  }
}

/* On paper: no actions, no card chrome, and rows that never split. */
@media print {
  .sheet {
    padding: 0;
    border: none;
    box-shadow: none;
  }

  .sheet .actions {
    display: none;
  }

  .table tr,
  .totals,
  .notes {
    break-inside: avoid;
  }
}