dolfindevelopers

Merchants table

ComponentExpensesSDK + UI

The merchants the organisation's cards have been used at: name with category, expense count, how many spellings the card networks use, last used and spend per currency. A debounced search by name or spelling, cursor pagination and rows that open the merchant. Takes columns, rowActions and initial filters (search). Pass merchants (with loading, error and page props) to render your own rows without a request.

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/expenses-merchants-table

Also installs: input, base-data-table, base-entity-cell, base-money, base-states, base-theme, ui-expenses-merchants-table.

Usage

screen.tsx
import { MerchantsTable } from "@/components/dolfin/expenses/merchants-table";

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

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
filtersMerchantListFiltersInitial filters: the search. A changed value re-applies.
pageSizenumber
onSearchChange(search: string) => void
hideSearchbooleanHide the search box (a list you filter elsewhere).
toolbarActionsstring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Extra controls beside the search.
merchantsreadonly { id?: string; displayName?: null | string; logoUrl?: null | string; mcc?: null | string; categoryLabel?: null | string; country?: …Merchants you already hold: rendered as given, without the search box, and nothing is fetched.
loadingboolean
errorError
onRetry() => void
pagenumber1-based page, for the pager in data mode.
hasNextPageboolean
onPageChange(page: number) => void
searchstringThe search your rows were narrowed by, for the "No merchants match" empty state.
columnsMerchantColumnsProp
columnOrderreadonly string[]
columnVisibilityReadonly<Record<string, boolean>>
rowActionsMerchantRowActionsPropNone by default.
getRowRoute(merchant: Merchant) => DolfinRoute | nullWhere a row links to when there is no `onRowClick`; the merchant by default (`null` for a plain row).
onRowClick(merchant: Merchant) => voidCalled when a row is clicked; given, it replaces the row's link.
emptyStatestring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Replaces the default empty state (with and without a search).
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; displayName?: null | string; logoUrl?: null | string; mcc?: null | string; categoryLabel?: null | string; country?: nul…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
expenses.merchants

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.

useDolfinLocaleuseMerchantsuseMessages

Files

Written to your app by the install command:

  • components/dolfin/expenses/merchants-table.tsx 371 lines