Expenses home
The expenses overview page: whose spend and period pickers, the headline tiles, spend over time, last month's close, where it went, top merchants, spenders and cards, home and abroad, receipts, VAT and approvals, each loading and failing on its own. A link-a-card empty state (onSetUpCard or emptyState), sections to hide, initial filters with a change callback, and ReactNode props for header actions 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-homeAlso installs: button, select, base-theme, base-page, base-states, expenses-spender-filter, expenses-summary-cards, expenses-report-spend, expenses-report-rankings, expenses-report-compliance, expenses-report-vat, expenses-report-approvals, ui-expenses-home.
Usage
import { ExpensesHome } from "@/components/dolfin/expenses/expenses-home";
// A whole screen: mount it on a route, inside your <DolfinProvider>.
export default function Route() {
return <ExpensesHome />;
}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… | Rendered before the spender and period pickers on the right of the header. |
emptyState | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Replaces the "link a card" empty state (no cards and no spend yet). Card linking lives with the host: pass your own flow here, or `onSetUpCard` for the built-in button. |
aside | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Rendered after the report cards, full width: card connections, accounting sync, anything of your own. |
filters | ExpensesHomeFiltersInitial | Where the page starts: the period and whose spend. Read once. |
onFiltersChange | (next: ExpensesHomeFiltersSnapshot) => void | Called after each change, e.g. to write the period back to the URL. |
hide | readonly ExpensesHomeSection[] | Sections to hide, e.g. `["location", "approvals"]`. |
hideSpenderFilter | boolean | Hides the whose-spend picker; the page shows everyone's spend (or `filters.scope`). |
hideMine | boolean | Hides "My spend" in the picker (an API key has no "me"). |
onAskAgent | (prompt: string, tile: ExpensesSummaryTileKey) => void | Adds an Ask agent button to the Spend and VAT tiles. |
onSetUpCard | () => void | Shows a Link a card button in the empty state. |
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… | |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
expenses.home
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.
useExpensesHomeCardsuseExpensesHomeFiltersuseExpensesSpendReportuseMessagesFiles
Written to your app by the install command:
components/dolfin/expenses/expenses-home.tsx240 linescomponents/dolfin/expenses/expenses-period-select.tsx34 lines