dolfindevelopers

Expenses table

ComponentExpensesSDK + UI

Card spend, most recent first: merchant with its category and the card's own spelling, who spent it, the card, the date, status with the flag as the thing to do, receipt presence and amount. Rows link to the expense. Cursor paging and an empty state for each view (nothing stuck, nothing to approve, every receipt in, no spend for this person, nothing for these filters), plus loading and error states. Fetches by filters or merchant, or shows the expenses you pass (with loading, error and paging props) and fetches nothing. Configurable columns and row actions; ExpenseRowsTable renders rows the caller already has (search results).

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

Also installs: badge, button, base-theme, base-data-table, base-entity-cell, base-money, base-states, expenses-status, ui-expenses-table.

Usage

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

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

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
filtersExpenseListFiltersFetches the expenses matching these filters.
merchantIdstringFetches the expenses made at this merchant (adds `merchantId` to `filters`).
pageSizenumberExpenses per page when the table fetches.
expensesreadonly { id?: string; organisationId?: string; cardConnectionId?: string; cardLast4?: null | string; cardNetwork?: null | string; cardDisp…Your expenses. Passing `expenses`, `loading` or `error` means the table fetches nothing.
loadingbooleanWith no expenses yet, the loading state; with expenses on screen, a refresh cue.
errorError
onRetry() => voidShows "Try again" in the error state.
pagenumberThe page on screen, from 1.
hasNextPageboolean
onPageChange(page: number) => voidShows the pager; called with the page to show.
emptyKindExpenseListEmptyKindWhich empty state to show. Worked out from `filters` when not given.
spenderLabelstringNames the person in the "No spend for this person" empty state.
onClearFilters() => voidShows "Clear filters" in the filtered empty state.
onCountChange(count: number) => voidReports the number of expenses on the current page.
columnsColumnsReplace or extend the default columns (merchant, spent by, card, date, status, receipt, amount).
columnOrderreadonly string[]
columnVisibilityReadonly<Partial<Record<string, boolean>>>
rowActionsRowActionsMenu entries per row. None by default: the row itself opens the expense.
classNamestring
variantDataTableVariant
emptyStatestring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…
onRowClick(expense: Expense) => voidCalled when a row is clicked; given, it replaces the row's link.
getRowRoute(expense: Expense) => DolfinRoute | nullWhere a row leads. Defaults to the expense page.
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; cardConnectionId?: string; cardLast4?: null | string; cardNetwork?: null | string; cardDisplay…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.
sortDataTableSort
onSortChange(sort: DataTableSort | null) => void

Customisation

Without editing the source, you can change:

Class names
classNameclassNames.frameclassNames.headerclassNames.headerCellclassNames.rowclassNames.cellclassNames.pager
Messages
expenses.expenses

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.

useDolfinLocaleuseExpensesuseMessages

Files

Written to your app by the install command:

  • components/dolfin/expenses/expenses-table.tsx 326 lines
  • components/dolfin/expenses/expenses-table-cells.tsx 173 lines