dolfindevelopers

Bills table

ComponentPayablesSDK + UI

Bills newest first with supplier, invoice number and date, due date with overdue emphasis, amount, outstanding, confidence, state and an optional match column. Row actions for the bill's state (approve, reject, reopen, retry extraction) behind confirmations, disabled with the reason for roles that can't take them. Configurable columns, state labels and tones, and row actions, rows that link to the bill, 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

Choose your integration

Ready to connect to Dolfin. Loads data through SDK hooks, with appearance and behaviour you can customise. Requires DolfinProvider.

Loading preview…

Installation

Needs the Dolfin registry token. The CLI copies the source into your app.

Terminal
bunx --bun shadcn@4.23.0 add @dolfin/ap-bills-table

Also installs: button, dialog, dropdown-menu, input, base-theme, base-data-table, base-entity-cell, base-info-hint, base-money, base-status-badge, base-states, ui-ap-bills-table.

Usage

screen.tsx
import { ApBillsTable } from "@/components/dolfin/ap/bills-table";

// Place it anywhere inside your <DolfinProvider>.
<ApBillsTable />

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

PropTypeDescription
filtersBillListFiltersFilters for the list this table loads itself.
billsreadonly { id?: string; organisationId?: string; state?: components["schemas"]["BillState"]; source?: components["schemas"]["BillSource"]; e…The bills to show. Passing them (or `loading` / `error`) fetches nothing; rows still link to the bill.
loadingboolean
errorError
onRetry() => void
pagenumber1-based page shown; the pager shows with `onPageChange`.
hasNextPageboolean
onPageChange(page: number) => void
filteredbooleanWith your bills: the list is filtered, so the empty state says "No bills match".
pageSizenumberBills per page when the table fetches.
columnsBillColumn[] | ((defaults: BillColumn[]) => BillColumn[])Replace or extend the default columns.
columnOrderreadonly string[]
columnVisibilityReadonly<Partial<Record<string, boolean>>>
stateLabelsPartial<Record<"Created" | "Extracting" | "PendingReview" | "NeedsApproval" | "Approved" | "Rejected" | "Scheduled" | "Paid" | "ExtractionFa…Your words per bill state in the state column, e.g. `{ NeedsApproval: "To approve" }`.
stateTonePartial<Record<"Created" | "Extracting" | "PendingReview" | "NeedsApproval" | "Approved" | "Rejected" | "Scheduled" | "Paid" | "ExtractionFa…Your badge tone per bill state in the state column, e.g. `{ Scheduled: "warning" }`.
stateCellBillStateCellOptionsThe state column's badge: `{ variant: "dot", flags: ["overdue"], badgeClassName, className }`.
rowActionsBillRowAction[] | ((defaults: BillRowAction[]) => BillRowAction[])The row menu. Fetching, the defaults are Open bill, the review actions the bill's state offers (submit, approve, reject, reopen, retry extraction; disabled with the reason for roles that can't) and Open bill match. With your bills there are none: the menu shows only the actions you pass.
pendingIdstringWith your bills: the bill whose action is running; its row menu shows busy.
onRowClick(bill: BillListItem) => voidCalled when a row is clicked; given, it replaces the row's link.
getRowRoute(bill: BillListItem) => DolfinRoute | nullWhere a row links to when there is no `onRowClick`; the bill by default (`null` for a plain row).
onNavigate(route: DolfinRoute) => voidOverrides the provider's navigation for row actions.
sortDataTableSort
onSortChange(sort: DataTableSort | null) => void
onCountChange(count: number) => voidReports the number of bills on the current page.
emptyStatestring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Replaces the default empty state.
classNamestring
variantDataTableVariant
classNamesDataTableClassNames
pagerbooleanShow 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; state?: components["schemas"]["BillState"]; source?: components["schemas"]["BillSource"]; eInv…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
ap.bill.actionsap.bill.approvalap.billsap.dueInap.dueTodayap.noValueap.overdueap.statesap.tablebase.infoHint.moreAbout

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.

useBillRowActionsuseBillsuseDolfinHasRouteuseDolfinLocaleuseDolfinNavigateuseMessages

Files

Written to your app by the install command:

  • components/dolfin/ap/bills-table.tsx 358 lines
  • components/dolfin/ap/bills-table-cells.tsx 244 lines
  • components/dolfin/ap/bills-table-actions.tsx 245 lines