dolfindevelopers

Expense headline tiles

ComponentExpensesSDK + UI

Spend for the period against the previous one, Missing receipts, VAT reclaimable (with the estimate at risk) and Awaiting approval, for a period and whose spend. The receipt and approval tiles open their expenses views. Loading and error states, optional Ask agent buttons, and ExpensesStatCard for custom tiles. Pass kpis (with loading and error) to render your own figures 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-summary-cards

Also installs: skeleton, base-theme, base-money, base-stat-card, base-states, ui-expenses-summary-cards, base-info-hint.

Usage

screen.tsx
import { ExpensesSummaryCards } from "@/components/dolfin/expenses/summary-cards";

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

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
tilesreadonly ExpensesSummaryTileKey[]Which built-in tiles to show, in order. Defaults to Spend, Missing receipts, VAT reclaimable, Awaiting approval.
extraTilesstring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Custom tiles after the built-in ones; build them with `ExpensesStatCard`. A function gets the reports this component read (not called when you pass `kpis`).
kpisExpensesHomeKpisFigures you already hold (`deriveExpensesHomeKpis`): rendered as given and nothing is fetched.
loadingboolean
errorError
onRetry() => void
onAskAgent(prompt: string, tile: ExpensesSummaryTileKey) => voidShows an Ask agent button on the Spend and VAT tiles; the prompt is the tile's question for an assistant.
tileClassNamesStatCardClassNamesPer-part classes for every built-in tile (label, value, sub, ...).
classNamestring
period"Last7Days" | "Last30Days" | "Last90Days" | "MonthToDate" | "QuarterToDate" | "YearToDate" | "Last12Months"Defaults to the last 30 days.
scopeSpenderScopeWhose spend; defaults to everyone. `mine` needs a user session (an API key has no "me").

Customisation

Without editing the source, you can change:

Class names
className
Messages
base.statescore.errorsexpenses.home

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.

useExpensesHomeReportsuseMessages

Files

Written to your app by the install command:

  • components/dolfin/expenses/summary-cards.tsx 276 lines