Invoices table
Invoices newest first with customer, invoice number and issue date, due date with overdue emphasis, amount, outstanding and status. Row actions for the invoice's state (send a draft, remind or void an open invoice) behind confirmations, disabled with the reason for roles that can't take them. A customer preset (the customer column preset with a customer id) lists one customer's invoices by number without the customer column. Configurable columns and row actions, rows that link to the invoice, cursor pagination and loading, empty and error states.
Component: A piece you place inside your own screens: a table, a form, a card or a dialog. You decide the layout around it. Pages vs components
Ready to connect to Dolfin. Loads data through SDK hooks, with appearance and behaviour you can customise. Requires DolfinProvider.
Installation
Needs the Dolfin registry token. The CLI copies the source into your app.
bunx --bun shadcn@4.23.0 add @dolfin/ar-invoices-tableAlso installs: button, dialog, dropdown-menu, base-theme, base-data-table, base-entity-cell, base-info-hint, base-money, base-status-badge, base-states, ui-ar-invoices-table.
Usage
import { ArInvoicesTable } from "@/components/dolfin/ar/invoices-table";
// Place it anywhere inside your <DolfinProvider>.
<ArInvoicesTable />Renders inside DolfinProvider (set it up once). By default it loads its own data through the SDK. Supplied-data examples show how to override that behavior.
API reference
| Prop | Type | Description |
|---|---|---|
filters | InvoiceListFilters | Filters for the list the table loads. With your own `invoices`, they only pick the "no matches" empty state. |
customerId | string | Shows one customer's invoices (a customer page). Applied on top of `filters`, and not counted as a filter: the empty state reads "No invoices for this customer yet". Pair with `columns="customer"`. |
invoices | readonly { id?: string; organisationId?: string; customerId?: string; documentNumber?: null | string; currency: string; issueDate?: string; … | Your own rows: the table then shows them and makes no request. Its default row menu keeps only Open invoice and Open customer; add your own entries with `rowActions`. |
loading | boolean | |
error | Error | |
onRetry | () => void | |
page | number | 1-based page number, for your own rows. |
hasNextPage | boolean | |
onPageChange | (page: number) => void | Shows the pager for your own rows. |
pageSize | number | |
columns | InvoiceColumnPreset | InvoiceColumn[] | ((defaults: InvoiceColumn[]) => InvoiceColumn[]) | A preset (`"customer"`: invoice number, due, amount and status, without the customer), or columns that replace or extend the defaults. |
columnOrder | readonly string[] | |
columnVisibility | Readonly<Partial<Record<string, boolean>>> | |
rowActions | InvoiceRowAction[] | ((defaults: InvoiceRowAction[]) => InvoiceRowAction[]) | Replace or extend the row menu. Defaults: Open invoice; Send invoice (drafts); Send reminder and Void invoice (open invoices), each confirmed and disabled with the reason for roles that can't; Open customer. Void invoices get no default entries, so their rows have no menu unless an added action shows there. |
onRowClick | (invoice: InvoiceListItem) => void | Called when a row is clicked; given, it replaces the row's link. |
getRowRoute | (invoice: InvoiceListItem) => DolfinRoute | null | Where a row links to when there is no `onRowClick`; the invoice by default (`null` for a plain row). |
onNavigate | (route: DolfinRoute) => void | Overrides the provider's navigation for row actions. |
sort | DataTableSort | |
onSortChange | (sort: DataTableSort | null) => void | |
onCountChange | (count: number) => void | Reports the number of invoices on the current page. |
onClearFilters | () => void | Shown as the filtered empty state's action ("Clear filters"). |
emptyState | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Replaces the default empty state. |
emptyAction | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | The unfiltered empty state's action (e.g. a New invoice button). |
className | string | |
variant | DataTableVariant | |
classNames | DataTableClassNames | |
pager | boolean | Show the built-in previous / next pager when there is more than one page. Default true; pass false when you draw your own pager from the list's pagination (the table still dims while a page loads). |
onRowHover | (row: { id?: string; organisationId?: string; customerId?: string; documentNumber?: null | string; currency: string; issueDate?: string; due… | Called with the row the pointer moves onto, and with `null` when the pointer leaves the rows (e.g. to highlight the row's point in a chart next to the table). Moving between rows reports the new row without a `null` first. |
Customisation
Without editing the source, you can change:
- Class names
classNameclassNames.frameclassNames.headerclassNames.headerCellclassNames.rowclassNames.cellclassNames.pager- Messages
ar.invoice.statesar.invoicesbase.dataTablebase.infoHintbase.statescore.errors
Or edit the installed file directly: it is your code. See theming for colours and fonts.
Hooks
The SDK hooks this component uses. Use them directly from @dolfinai/react to build your own version.
useDolfinHasRouteuseDolfinHrefuseDolfinLocaleuseDolfinNavigateuseInvoiceRowActionsuseInvoicesuseMessagesFiles
Written to your app by the install command:
components/dolfin/ar/invoices-table.tsx341 linescomponents/dolfin/ar/invoices-table-cells.tsx100 linescomponents/dolfin/ar/invoices-table-actions.tsx128 lines