dolfindevelopers

Bill lines editor

ComponentPayablesSDK + UI

Add, remove, reorder and edit a bill's lines (description, SKU, quantity, unit, unit price, tax, category, spend class and tags) with AI suggestions one click away, each line's gross and a check that the lines add up to the bill total. Driven by useBillDraft. Also ships the unit, currency and category comboboxes and the tag input.

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/ap-bill-lines-editor

Also installs: badge, button, card, command, field, input, popover, select, base-theme, base-info-hint, base-money, base-states, ui-ap-bill-lines-editor.

Usage

screen.tsx
import { BillLinesEditor } from "@/components/dolfin/ap/bill-lines-editor";

// Place it anywhere inside your <DolfinProvider>.
<BillLinesEditor values={values} onChange={handleChange} />

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
values requiredBillDraftThe draft to edit, e.g. `useBillDraft(billId).draft`. A controlled form: every change goes to `onChange`.
onChange required(next: BillDraft) => void
errorsPartial<Record<BillDraftPath, string>>Messages by path (`lines.0.description`, ...).
dirtyFieldsreadonly string[]Paths changed since the bill was read, ringed (`useBillDraft(billId).dirtyFields`).
bill{ id?: string; organisationId?: string; state?: components["schemas"]["BillState"]; source?: components["schemas"]["BillSource"]; eInvoiceId…The bill the draft came from: its currency and the extraction's category suggestions.
categoriesreadonly { key: string; displayName: string; defaultSpendClass: null | components["schemas"]["SpendClass"]; source: string; }[]Spend categories to pick from. Given, nothing is fetched.
emptyStatestring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Replaces the note shown when the bill has no lines.
renderLineExtra(line: BillDraftLine, index: number) => ReactNodeExtra fields under a line (for example where it posts in your accounting system).
classNamestring

Customisation

Without editing the source, you can change:

Class names
className
Messages
ap.billDraftbase.infoHint.moreAboutbase.statescore.errors

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.

useBillCategoriesuseBillCurrenciesuseMessages

Files

Written to your app by the install command:

  • components/dolfin/ap/bill-lines-editor.tsx 312 lines
  • components/dolfin/ap/bill-draft-pickers.tsx 136 lines