Expense lines
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
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-expense-linesAlso installs: button, input, select, table, base-theme, base-info-hint, base-money, base-states, expenses-status, ui-expenses-expense-lines.
Usage
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
| Prop | Type | Description |
|---|---|---|
expense required | { id?: string; organisationId?: string; cardConnectionId?: string; cardLast4?: null | string; cardNetwork?: null | string; cardDisplayName?:… | |
view required | Pick<ExpenseView, "linesTotal" | "linesBalanced"> | |
accounts | readonly ExpenseLedgerAccount[] | The accounts that name each line: nothing is fetched then. The synced accounts are read when omitted. |
loading | boolean | The accounts are still being read. |
className | string |
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.
useExpenseActionsuseExpenseLedgerAccountsuseExpenseLinesDraftuseExpenseTaxRatesuseMessagesFiles
Written to your app by the install command:
components/dolfin/expenses/expense-lines.tsx133 linescomponents/dolfin/expenses/expense-lines-editor.tsx234 lines