Suppliers table
Suppliers with email, location, whether an address and bank details are on file (details on hover), payment terms and date added. Name and email filters, configurable columns and row actions, rows that link to the supplier, 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/ap-suppliers-tableAlso installs: button, input, tooltip, base-theme, base-data-table, base-entity-cell, base-states, ui-ap-suppliers-table.
Usage
import { ApSuppliersTable } from "@/components/dolfin/ap/suppliers-table";
// Place it anywhere inside your <DolfinProvider>.
<ApSuppliersTable />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 | SupplierListFilters | Filters for the list this table loads itself. |
pageSize | number | |
suppliers | readonly { id?: string; organisationId?: string; name: string; email?: null | string; phone?: null | string; website?: null | string; taxNum… | The suppliers to show. Passing them (or `loading` / `error`) fetches nothing; rows still link to the supplier. |
loading | boolean | |
error | Error | |
onRetry | () => void | |
page | number | 1-based page shown; the pager shows with `onPageChange`. |
hasNextPage | boolean | |
onPageChange | (page: number) => void | |
filtered | boolean | The list is filtered, so the empty state says nothing matches. |
columns | SupplierColumn[] | ((defaults: SupplierColumn[]) => SupplierColumn[]) | Replace or extend the default columns. |
columnOrder | readonly string[] | |
columnVisibility | Readonly<Partial<Record<string, boolean>>> | |
rowActions | SupplierRowAction[] | ((defaults: SupplierRowAction[]) => SupplierRowAction[]) | Replace or extend the row menu (defaults: Open supplier, and Edit when `onEdit` is given). |
onEdit | (supplier: Supplier) => void | Adds an Edit row action. |
editDisabledReason | string | Edit stays visible and is disabled with this reason in an InfoHint when non-empty (`""` = enabled). By id, `undefined` means the SDK's reason for a role that can't manage them. |
onRowClick | (supplier: Supplier) => void | Called when a row is clicked; given, it replaces the row's link. |
getRowRoute | (supplier: Supplier) => DolfinRoute | null | Where a row links to when there is no `onRowClick`; the supplier by default (`null` for a plain row). |
onNavigate | (route: DolfinRoute) => void | |
sort | DataTableSort | |
onSortChange | (sort: DataTableSort | null) => void | |
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… | An action inside the default empty state (e.g. a New supplier button). |
onClearFilters | () => void | Shown in the default "no matches" state, to clear the filters. |
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; name: string; email?: null | string; phone?: null | string; website?: null | string; taxNumber… | 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.suppliers
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.
useCanManageSuppliersuseDolfinHasRouteuseDolfinLocaleuseDolfinNavigateuseMessagesuseSuppliersFiles
Written to your app by the install command:
components/dolfin/ap/suppliers-table.tsx328 linescomponents/dolfin/ap/suppliers-filters.tsx36 lines