dolfindevelopers

Customers table

ComponentReceivablesSDK + UI

Customers with email and phone, location, whether an address and a tax number are on file (details on hover) and date added. Name and email filters, configurable columns and row actions (Edit, Delete, Open), rows that link to the customer, 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/ar-customers-table

Also installs: button, input, tooltip, base-theme, base-data-table, base-entity-cell, base-states, ui-ar-customers-table.

Usage

screen.tsx
import { ArCustomersTable } from "@/components/dolfin/ar/customers-table";

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

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
filtersCustomerListFiltersFilters for the list the table loads. With your own `customers`, they only pick the "no matches" empty state.
customersreadonly { id?: string; organisationId?: string; name: string; email?: null | string; phone?: null | string; taxNumber?: null | string; addr…Your own rows: the table then shows them and makes no request.
loadingboolean
errorError
onRetry() => void
pagenumber1-based page number, for your own rows.
hasNextPageboolean
onPageChange(page: number) => voidShows the pager for your own rows.
pageSizenumber
columnsCustomerColumn[] | ((defaults: CustomerColumn[]) => CustomerColumn[])Replace or extend the default columns.
columnOrderreadonly string[]
columnVisibilityReadonly<Partial<Record<string, boolean>>>
rowActionsCustomerRowAction[] | ((defaults: CustomerRowAction[]) => CustomerRowAction[])Replace or extend the row menu (defaults: Edit and Delete when their handlers are given, then Open customer).
onEdit(customer: Customer) => voidAdds an Edit row action.
onDelete(customer: Customer) => voidAdds a Delete row action.
editDisabledReasonstringEdit and Delete stay 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.
deleteDisabledReasonstringThe same for Delete.
isRowBusy(customer: Customer) => booleanShows a spinner on a row's actions (e.g. while it is being deleted).
onRowClick(customer: Customer) => voidCalled with the row clicked, for hosts that open the customer their own way. Given, rows (and the Open row action) call it instead of linking.
getRowRoute(customer: Customer) => DolfinRoute | nullWhere a row links to when there is no `onRowClick`; the customer by default (`null` for a plain row).
onNavigate(route: DolfinRoute) => void
sortDataTableSort
onSortChange(sort: DataTableSort | null) => void
emptyStatestring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Replaces the default empty state.
emptyActionstring | 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 customer button).
onClearFilters() => voidShown in the default "no matches" state, to clear the filters.
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; name: string; email?: null | string; phone?: null | string; taxNumber?: null | string; address…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.customers

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.

useCanManageCustomersuseCustomersuseDolfinHasRouteuseDolfinLocaleuseDolfinNavigateuseMessages

Files

Written to your app by the install command:

  • components/dolfin/ar/customers-table.tsx 295 lines
  • components/dolfin/ar/customers-filters.tsx 27 lines