Expenses list page
Card spend as a work queue: a natural-language search, then the views (Needs attention, To approve, Missing receipts, All spend) narrowed by whose spend, dates and card, over the expenses table. Filters (view, search, card, whose spend, dates, merchant) that round-trip through the URL with expenseFiltersFromSearch and expenseFiltersToSearch, configurable columns and row actions, and ReactNode props for header actions, the empty state and an aside.
Page: A complete screen for one route, such as a bill or the invoices list. Mount it on a route in your app; connected SDK pages provide data and actions; standalone UI pages receive them as props. 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/expenses-list-pageAlso installs: base-theme, base-page, expenses-filters, expenses-search, expenses-table, ui-expenses-list-page.
Usage
import { ExpensesListPage } from "@/components/dolfin/expenses/expenses-list-page";
// A whole screen: mount it on a route, inside your <DolfinProvider>.
export default function Route() {
return <ExpensesListPage />;
}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 |
|---|---|---|
headerActions | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Buttons on the right of the header (export, link a card). |
emptyState | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Replaces the table's empty state (and the search's "Nothing matches"). |
aside | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Beside the list on wide pages (card connections, spend insights). |
filters | ExpenseFiltersInitial | The filters: the view, the search, a card ("View spend" from a card), whose spend, dates and a merchant ("See every expense at this merchant"). `expenseFiltersFromSearch` reads them from the URL. A changed value re-applies. |
onFiltersChange | (next: ExpenseFiltersSnapshot) => void | Called after each change, the search included, e.g. to write them back to the URL with `expenseFiltersToSearch`, so coming back from an expense lands on the same results. |
baseFilters | ExpenseListFilters | Filters always applied under the views. |
searchQuery | string | Controls the search on its own (with `onSearchChange`), instead of through `filters.query`. |
onSearchChange | (query: string) => void | |
hideSearch | boolean | Hides the natural-language search. |
hideFilters | readonly ExpensesFilterControl[] | |
pageSize | number | |
columns | Columns | |
columnOrder | readonly string[] | |
columnVisibility | Readonly<Partial<Record<string, boolean>>> | |
rowActions | RowActions | |
title | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | |
eyebrow | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | |
description | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
expenses.expenses
Or edit the installed file directly: it is your code. See theming for colours and fonts.
Hooks
The SDK hooks this page uses. Use them directly from @dolfinai/react to build your own version.
useExpenseFiltersuseMessagesFiles
Written to your app by the install command:
components/dolfin/expenses/expenses-list-page.tsx159 lines