dolfindevelopers

Bill edit form

ComponentPayablesSDK + UI

A bill's header fields for review: a supplier picker (searched on the server, or your own `suppliers` list with no request) with the extraction's suggestion one click away, currency, invoice and PO numbers, payment terms, dates, the supplier's details as printed, amounts and payment details. Changed fields are marked and the API's field errors show in place. A controlled form (`values`, `onChange`, `errors`), driven by useBillDraft.

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-edit-form

Also installs: button, calendar, card, command, field, input, popover, base-theme, ap-bill-lines-editor, ui-ap-bill-edit-form.

Usage

screen.tsx
import { BillEditForm } from "@/components/dolfin/ap/bill-edit-form";

// Place it anywhere inside your <DolfinProvider>.
<BillEditForm 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 field (`invoiceNumber`, `dueDate`, ...).
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 supplier and the extraction's suggestion.
suggestedSupplierBillSupplierSuggestionThe extraction's suggested supplier, offered while another is picked.
onCreateSupplier() => voidOffers "New Supplier" in the supplier picker; open your create-supplier dialog from here.
onSupplierClick(supplierId: string) => voidMakes the suggested supplier's name a link (for example to the supplier page).
suppliersreadonly BillSupplierOption[]Your suppliers for the supplier picker. Given, the picker filters these as the reviewer types and the form makes no supplier request (an unknown supplier id shows as itself until you name it in this list).
onSupplierSearch(query: string) => voidWith `suppliers`: the picker's search as typed, debounced 400ms, so you can load more.
currenciesreadonly { id?: string; code: string; name: string; symbol: string; decimalPlaces?: number | string; }[]Your currencies for the currency picker. Given, the list is not fetched.
hideSectionsBillEditSection[]Sections to leave out (for hosts that edit supplier or payment details elsewhere).
childrenstring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Extra cards after the built-in ones.
classNamestringOn the form's wrapper.
classNamesBillEditFormClassNames

Customisation

Without editing the source, you can change:

Class names
classNameclassNames.cardclassNames.cardHeaderclassNames.cardTitleclassNames.cardContent
Messages
ap.billDraftbase.states.retry

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.

useBillSupplieruseBillSupplierOptionsuseDolfinLocaleuseMessages

Files

Written to your app by the install command:

  • components/dolfin/ap/bill-edit-form.tsx 180 lines
  • components/dolfin/ap/bill-edit-fields.tsx 165 lines