dolfindevelopers

Expense spend reports

ComponentExpensesSDK + UI

Spend over time (bars per day, week or month with the previous period), where it went (category families that open to your own categories) and home against abroad, each reading the spend report for a period and whose spend, with loading, empty and error states.

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-report-spend

Also installs: tooltip, base-theme, base-money, expenses-report-card, ui-expenses-report-spend.

Usage

screen.tsx
import { ExpensesSpendOverTimeCard } from "@/components/dolfin/expenses/report-spend";

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

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
report{ asOf?: string; period?: components["schemas"]["LookbackPeriod"]; periodStart?: string; periodEnd?: string; granularity?: components["schem…The report you already hold; `null` while you have none.
loadingboolean
errorError
onRetry() => void
titlestringOverrides the card's title.
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
expenses.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.

useDolfinLocaleuseExpensesSpendReportuseMessages

Files

Written to your app by the install command:

  • components/dolfin/expenses/report-spend.tsx 185 lines