dolfindevelopers

Purchase orders table

ComponentPayablesSDK + UI

Purchase orders with supplier, PO number, status, line chips, expected delivery and net total. Debounced search, a supplier filter, cursor pagination, rows that link to the order, and Close and Cancel row actions. Takes columns, rowActions and initial filters.

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-purchase-orders-table

Also installs: ap-purchase-order-parts, base-data-table, base-entity-cell, base-states, base-money, ui-ap-purchase-orders-table.

Usage

screen.tsx
import { PurchaseOrdersTable } from "@/components/dolfin/ap/purchase-orders-table";

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

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
filtersOrderListFiltersInitial filters when the table fetches: a supplier, a search.
pageSizenumber
hideToolbarbooleanHide the search and supplier filter (shown only when the table fetches).
toolbarActionsstring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Extra controls at the end of the toolbar.
purchaseOrdersreadonly { id?: string; organisationId?: string; supplierId?: null | string; externalRef?: null | string; poNumber: string; currency: string…The rows to show. Passing them (or `loading` / `error`) fetches nothing; rows still link to the purchase order.
loadingboolean
errorError
onRetry() => void
pagenumber1-based page shown; the pager shows with `onPageChange`.
hasNextPageboolean
onPageChange(page: number) => void
supplierNamesReadonly<Record<string, string>>Supplier names by id, for the supplier column.
supplierIdstringThe list is one supplier's: the supplier column gives way to the number.
filteredbooleanThe list is filtered, so the empty state says nothing matches.
onClose(row: PurchaseOrder) => voidShows Close on open rows. Wired for you when the table fetches.
onCancel(row: PurchaseOrder) => voidShows Cancel on open rows. Wired for you when the table fetches.
pendingIdstringThe row an action is running on: its menu shows progress.
columnsPurchaseOrderColumnsProp
columnOrderreadonly string[]
columnVisibilityReadonly<Record<string, boolean>>
rowActionsPurchaseOrderRowActionsPropReplace or extend the row menu (Close, Cancel when their callbacks are given). Pass `[]` for none.
onRowClick(row: PurchaseOrder) => voidCalled when a row is clicked; given, it replaces the row's link.
getRowRoute(row: PurchaseOrder) => DolfinRoute | nullWhere a row links to when there is no `onRowClick`; the purchase order by default (`null` for a plain row).
emptyStatestring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…
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; supplierId?: null | string; externalRef?: null | string; poNumber: string; currency: string; s…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.orders

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.

useDolfinLocaleuseMessagesusePurchaseOrderActionsusePurchaseOrders

Files

Written to your app by the install command:

  • components/dolfin/ap/purchase-orders-table.tsx 334 lines