dolfindevelopers

Expense lines

ComponentExpensesSDK + UI

An expense's coding lines as they will post (description, account, amount, VAT, tax rate with the reason when none could be matched, VAT reclaim and where the coding came from) with the lines total against the expense, and an editor that splits it across accounts: a named rate keeps the VAT in step, a new line takes what is left, one rate for every line, and Save stays off until the lines add up and every line has an account.

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-expense-lines

Also installs: button, input, select, table, base-theme, base-info-hint, base-money, base-states, expenses-status, ui-expenses-expense-lines.

Usage

screen.tsx
import { ExpenseLines } from "@/components/dolfin/expenses/expense-lines";

// Place it anywhere inside your <DolfinProvider>.
<ExpenseLines expense={expense} view={view} />

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
expense required{ id?: string; organisationId?: string; cardConnectionId?: string; cardLast4?: null | string; cardNetwork?: null | string; cardDisplayName?:…
view requiredPick<ExpenseView, "linesTotal" | "linesBalanced">
accountsreadonly ExpenseLedgerAccount[]The accounts that name each line: nothing is fetched then. The synced accounts are read when omitted.
loadingbooleanThe accounts are still being read.
classNamestring

Customisation

Without editing the source, you can change:

Class names
className
Messages
base.infoHint.moreAboutexpenses.expense

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.

useExpenseActionsuseExpenseLedgerAccountsuseExpenseLinesDraftuseExpenseTaxRatesuseMessages

Files

Written to your app by the install command:

  • components/dolfin/expenses/expense-lines.tsx 133 lines
  • components/dolfin/expenses/expense-lines-editor.tsx 234 lines