# Invoice preview

A consumer-owned invoice document with semantic parties, dates, line items, totals and native optional actions.

Access: pro. Category: Blocks. Kind: composite.

## When to use

- Use it when a page needs a consumer-owned invoice document with semantic parties, dates, line items, totals and native optional actions.
- Choose it inside an authenticated product surface when the host application owns routing, persistence, and service calls.

## Alternatives

- Choose empty-state instead when empty collections, search results and errors with a clear next action is the actual interface need, rather than invoice preview.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Invoice preview

```sh
npx shadcn@latest add @tidal-pro/invoice-preview
```

Stylesheets: `components/ui/tidal.css`, `components/ui/invoice-preview.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/invoice-preview.css";
import{TidalInvoicePreview}from"./components/ui/invoice-preview";
export default(p:Parameters<typeof TidalInvoicePreview>[0])=><div className="tidal-scope"><TidalInvoicePreview {...p}/></div>;
```

## Structured props

- `TidalInvoicePreview.accessibleName: string`: Required accessible name value accepted by this exported component.
- `TidalInvoicePreview.billTo: TidalInvoiceParty`: Required bill to value accepted by this exported component.
- `TidalInvoicePreview.from: TidalInvoiceParty`: Required from value accepted by this exported component.
- `TidalInvoicePreview.invoiceNumber: ReactNode`: Required invoice number value accepted by this exported component.
- `TidalInvoicePreview.issueDate: TidalInvoiceDate`: Required issue date value accepted by this exported component.
- `TidalInvoicePreview.lineItems: ReadonlyArray<TidalInvoiceLineItem>`: Required line items value accepted by this exported component.
- `TidalInvoicePreview.lineItemsCaption: ReactNode`: Required line items caption value accepted by this exported component.
- `TidalInvoicePreview.status: ReactNode`: Required status value accepted by this exported component.
- `TidalInvoicePreview.totals: ReadonlyArray<TidalInvoiceTotal>`: Required totals value accepted by this exported component.
- `TidalInvoicePreview.actions?: ReadonlyArray<TidalInvoiceAction> | undefined`: Optional actions value accepted by this exported component.
- `TidalInvoicePreview.columnLabels?: Partial<TidalInvoiceColumnLabels> | undefined`: Optional column labels value accepted by this exported component.
- `TidalInvoicePreview.currencyNote?: ReactNode`: Optional currency note value accepted by this exported component.
- `TidalInvoicePreview.dueDate?: TidalInvoiceDate | undefined`: Optional due date value accepted by this exported component.
- `TidalInvoicePreview.emptyLineItemsMessage?: ReactNode` (default "No line items are available."): Optional empty line items message value accepted by this exported component.
- `TidalInvoicePreview.footer?: ReactNode`: Optional footer value accepted by this exported component.
- `TidalInvoicePreview.headingLevel?: "h2" | "h3" | "h4" | undefined` (default "h2"): Optional heading level value accepted by this exported component.
- `TidalInvoicePreview.labels?: Partial<TidalInvoiceLabels> | undefined`: Optional labels value accepted by this exported component.
- `TidalInvoicePreview.lineItemsScrollProps?: Omit<HTMLAttributes<HTMLDivElement>, "aria-label" | "children"> | undefined`: Optional line items scroll props value accepted by this exported component.
- `TidalInvoicePreview.lineItemsScrollRef?: Ref<HTMLDivElement> | undefined`: Optional line items scroll ref value accepted by this exported component.
- `TidalInvoicePreview.notes?: ReactNode`: Optional notes value accepted by this exported component.
- `TidalInvoicePreview.purchaseOrder?: ReactNode`: Optional purchase order value accepted by this exported component.
- `TidalInvoicePreview.tableProps?: Omit<TableHTMLAttributes<HTMLTableElement>, "children"> | undefined`: Optional table props value accepted by this exported component.
- `TidalInvoicePreview.tableRef?: Ref<HTMLTableElement> | undefined`: Optional table ref value accepted by this exported component.
- `TidalInvoicePreview.title?: ReactNode` (default "Invoice"): Optional title value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/invoice-preview.tsx) | [Manifest](https://tidalui.com/examples/invoice-preview.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
"use client";

import "./components/ui/tidal.css";

import { useId, useMemo, useState } from "react";

import { TidalInvoicePreview, type TidalInvoiceLineItem } from "./components/ui/invoice-preview";

import "./components/ui/invoice-preview.css";



const tidalExampleStyles = ".tidal-scope .invoice-preview-demo,\n.tidal-scope .invoice-preview-demo * {\n  box-sizing: border-box;\n}\n\n.tidal-scope .invoice-preview-demo {\n  width: 100%;\n  max-width: 1120px;\n  min-width: 0;\n  container: invoice-preview-demo / inline-size;\n}\n\n.tidal-scope .invoice-preview-demo-layout {\n  display: grid;\n  min-width: 0;\n  gap: 12px;\n  padding: 20px;\n  border: 1px solid var(--t-border);\n  border-radius: 22px;\n  background:\n    linear-gradient(var(--t-border) 1px, transparent 1px),\n    linear-gradient(90deg, var(--t-border) 1px, transparent 1px),\n    var(--t-subtle);\n  background-size: 28px 28px;\n}\n\n.tidal-scope .invoice-preview-demo-picker {\n  display: grid;\n  width: min(100%, 300px);\n  gap: 5px;\n  padding: 10px;\n  border: 1px solid var(--t-border);\n  border-radius: 10px;\n  background: var(--t-surface);\n  color: var(--t-muted);\n  font-size: 11px;\n  font-weight: 670;\n  letter-spacing: 0.05em;\n  line-height: 1.35;\n}\n\n.tidal-scope .invoice-preview-demo-picker > span {\n  min-width: 0;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .invoice-preview-demo-picker select {\n  width: 100%;\n  min-width: 0;\n  min-height: 44px;\n  padding: 8px 10px;\n  border: 1px solid var(--t-border);\n  border-radius: 8px;\n  background: var(--t-surface);\n  color: var(--t-ink);\n  font: inherit;\n  font-size: 16px;\n  line-height: 1.4;\n}\n\n.tidal-scope .invoice-preview-demo-picker select:focus-visible {\n  outline: 2px solid var(--t-accent);\n  outline-offset: 3px;\n}\n\n.tidal-scope .invoice-preview-demo-boundary {\n  min-width: 0;\n  padding: 20px;\n  border: 1px solid var(--t-border);\n  border-radius: 18px;\n  background: var(--t-ink);\n  color: var(--t-surface);\n  scroll-margin-block: 18px;\n}\n\n.tidal-scope .invoice-preview-demo-boundary:focus-visible {\n  outline: 2px solid var(--t-accent);\n  outline-offset: 3px;\n}\n\n.tidal-scope .invoice-preview-demo-boundary > span {\n  color: color-mix(in srgb, var(--t-surface) 62%, var(--t-ink));\n  font-size: 11px;\n  font-weight: 690;\n  letter-spacing: 0.09em;\n  line-height: 1.35;\n  text-transform: uppercase;\n}\n\n.tidal-scope .invoice-preview-demo-boundary h3 {\n  margin: 8px 0 0;\n  font-size: 18px;\n  font-weight: 650;\n  letter-spacing: -0.035em;\n  line-height: 1.25;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .invoice-preview-demo-boundary p {\n  max-width: 72ch;\n  margin: 7px 0 0;\n  color: color-mix(in srgb, var(--t-surface) 72%, var(--t-ink));\n  font-size: 11px;\n  line-height: 1.6;\n  overflow-wrap: anywhere;\n}\n\n@container invoice-preview-demo (max-width: 520px) {\n  .tidal-scope .invoice-preview-demo-layout {\n    gap: 9px;\n    padding: 8px;\n  }\n\n  .tidal-scope .invoice-preview-demo-picker {\n    width: 100%;\n  }\n\n  .tidal-scope .invoice-preview-demo-boundary {\n    padding: 17px;\n  }\n}";

type SampleInvoiceId = "sample-1048" | "sample-1036";

interface SampleInvoice {
  id: SampleInvoiceId;
  issue: { dateTime: string; label: string };
  due: { dateTime: string; label: string };
  reference: string;
  rows: readonly (TidalInvoiceLineItem & { note: string })[];
  subtotal: string;
  adjustment: string;
  total: string;
}

const SAMPLE_INVOICES: readonly SampleInvoice[] = [
  {
    id: "sample-1048",
    issue: { dateTime: "2026-10-01", label: "October 1, 2026" },
    due: { dateTime: "2026-10-15", label: "October 15, 2026" },
    reference: "PO-1048",
    rows: [
      {
        id: "brief-layout",
        description: "Product design",
        detail: "Website interface and responsive layouts.",
        note: "Includes the homepage, component library, and responsive layouts.",
        quantity: "1",
        rate: "$16.00",
        total: "$16.00",
      },
      {
        id: "checklist-layout",
        description: "Design review",
        detail: "Interface review and handoff.",
        note: "Review notes and developer handoff.",
        quantity: "1",
        rate: "$8.00",
        total: "$8.00",
      },
    ],
    subtotal: "$24.00",
    adjustment: "$0.00",
    total: "$24.00",
  },
  {
    id: "sample-1036",
    issue: { dateTime: "2026-09-01", label: "September 1, 2026" },
    due: { dateTime: "2026-09-15", label: "September 15, 2026" },
    reference: "PO-1036",
    rows: [
      {
        id: "review-layout",
        description: "Design review",
        detail: "Interface review and revisions.",
        note: "Two rounds of interface review and revisions.",
        quantity: "2",
        rate: "$10.00",
        total: "$20.00",
      },
    ],
    subtotal: "$20.00",
    adjustment: "−$2.00",
    total: "$18.00",
  },
];

export function InvoicePreviewDemo() {
  const generatedId = useId().replace(/:/g, "");
  const disclosureId = `invoice-preview-${generatedId}-boundary`;
  const [invoiceId, setInvoiceId] = useState<SampleInvoiceId>("sample-1048");
  const [showNotes, setShowNotes] = useState(false);
  const [message, setMessage] = useState("Invoice 1048 selected.");
  const invoice = SAMPLE_INVOICES.find((entry) => entry.id === invoiceId)!;
  const rows = useMemo(
    () =>
      invoice.rows.map((row) => ({
        ...row,
        detail: showNotes ? row.note : row.detail,
      })),
    [invoice, showNotes],
  );

  return (
    <section
      className="invoice-preview-demo"
      aria-label="Invoice sample preview"
    >
      <div className="invoice-preview-demo-layout">
        <label className="invoice-preview-demo-picker">
          <span>Invoice</span>
          <select
            value={invoiceId}
            onChange={(event) => {
              const next =
                event.currentTarget.value === "sample-1036"
                  ? "sample-1036"
                  : "sample-1048";
              setInvoiceId(next);
              setShowNotes(false);
              setMessage(
                `${next === "sample-1048" ? "Invoice 1048" : "Invoice 1036"} selected.`,
              );
            }}
          >
            <option value="sample-1048">Invoice 1048</option>
            <option value="sample-1036">Invoice 1036</option>
          </select>
        </label>

        <TidalInvoicePreview
          key={invoice.id}
          accessibleName={`${invoice.id.replace("sample-", "Invoice ")} preview`}
          invoiceNumber={invoice.id.replace("sample-", "INV-")}
          status="Preview only"
          issueDate={invoice.issue}
          dueDate={invoice.due}
          purchaseOrder={invoice.reference}
          from={{
            label: "From",
            name: "Northstar Studio",
            lines: ["12 Paper Street", "Example City"],
            detail: "Design studio",
          }}
          billTo={{
            label: "Bill to",
            name: "Tidal Workspace",
            lines: ["24 Grove Avenue", "Example City"],
            detail: "Product team",
          }}
          lineItems={rows}
          lineItemsCaption={`Line items for ${invoice.id}`}
          totals={[
            { id: "subtotal", label: "Subtotal", value: invoice.subtotal },
            {
              id: "adjustment",
              label: "Adjustment",
              value: invoice.adjustment,
            },
            {
              id: "total",
              label: "Total",
              value: invoice.total,
              emphasis: true,
            },
          ]}
          currencyNote="All amounts in USD."
          notes="Thank you for working with Northstar Studio."
          actions={[
            {
              kind: "button",
              id: "toggle-row-notes",
              label: showNotes ? "Show short descriptions" : "Show item notes",
              buttonProps: { "aria-pressed": showNotes },
              onAction: () => {
                setShowNotes((current) => !current);
                setMessage(
                  showNotes ? "Short descriptions shown." : "Item notes shown.",
                );
              },
            },
            {
              kind: "link",
              id: "review-boundary",
              label: "About this sample",
              href: `#${disclosureId}`,
              onAction: () => setMessage("Sample details opened."),
            },
          ]}
          footer={
            <span role="status" aria-live="polite">
              {message} Sample data. Changes stay in this preview.
            </span>
          }
        />

        <aside
          id={disclosureId}
          className="invoice-preview-demo-boundary"
          tabIndex={-1}
        >
          <h3>About this sample</h3>
          <p>Sample data. Changes stay in this preview.</p>
        </aside>
      </div>
    </section>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <InvoicePreviewDemo />
    </div>
  );
}

```

## Gotchas

- The host application owns data, validation, persistence, navigation, and service side effects described by this API.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order.","Arrow-key behavior follows the exported composite-control implementation."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

accessibleName, invoiceNumber, status, issueDate, from, billTo, lineItems, lineItemsCaption and totals are required consumer-owned display data. Dates render as native time elements. Parties expose native address attributes/refs. Line items render in a captioned semantic table with row/column headers, native row attributes/refs and a bounded keyboard-scroll region that enters the tab order only when overflow is measured; explicit caller tabIndex wins and composed refs preserve React 19 callback cleanup. Optional dueDate, purchaseOrder, labels, column labels, empty copy, notes, currency note, native table/scroll attributes/refs, footer and heading level remain consumer-owned. Optional native link/button actions preserve href, modified navigation, type/form/disabled/attributes/refs and invoke higher callbacks only after unprevented native handling; disabled links suppress caller handling/navigation while explicit aria-disabled false is retained. The component performs no invoice issue, send, payment, export, accounting, request, network, storage or persistence action.
