# Invoice table

Every invoice with status, amount and a PDF, the amount owed in the header, and Pay on what is still due.

> chatcn Pro: needs a Pro license (https://chatcn.dev/pro). Install from the `@chatcn-pro` registry with your license token; setup at https://chatcn.dev/docs/chatcn-pro.

Example: Invoice table. A year of invoices with one past due. Pay it, sort by amount, or narrow to unpaid. Preview: https://chatcn.dev/preview/invoice-table-demo

## Installation

```bash
npx shadcn@latest add @chatcn-pro/invoice-table
```

## Usage

```tsx
import { InvoiceTable } from "@/components/ui/chatcn/pro/invoice-table"

<InvoiceTable
  invoices={[
    { id: "inv_42", number: "INV-0042", date: "2026-03-01", period: "Feb 1 to Feb 28", amount: 412.8, status: "past-due", pdfHref: "/invoices/42.pdf" },
  ]}
  currency="USD"
  onPay={(id) => openPayment(id)}
/>
```

Built on the free `data-table`: newest first, sortable by date and amount, a sticky header, and virtualized past 200 rows. Status reads in words with a colored dot (paid, due, past due, refunded, void). Rows still owed carry Pay, every row with a PDF carries a download, the header says how much is owed in total, and Unpaid narrows the list to just those. Date, amount and status come first so they stay in view on a phone.

## Examples

### States

Example: States. No invoices yet, loading, and a failed load with retry. Preview: https://chatcn.dev/preview/invoice-table-states

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `invoices` | `Invoice[]` | `{ id, number, date, period?, amount, status, pdfHref? }` |
| `currency`, `locale` | `string` | Formatting |
| `onPay` | `(id) => void` | Shows Pay on due and past due rows |
| `loading`, `error`, `onRetry` |  | From `data-table` |
| `labels` | `Partial<InvoiceTableLabels>` | Every string, including status words |

## Keyboard

| Key | Action |
| --- | --- |
| Tab | Moves through sort headers, Pay and downloads |

## Accessibility

- A real table with sortable column headers that report their order.
- Downloads are links named by the invoice number.
- Status is a word, not only a color.

## Motion

None.

Source: https://chatcn.dev/docs/components/invoice-table