Edit invoice page
Edit a draft invoice: customer, currency, memo and payment terms, then the lines, discounts and live totals. Only the changes are saved; changed fields are marked, field errors show in place and a conflicting change is flagged. Saves and returns to the invoice, or saves and sends through the send dialog. New Customer and New Product open the create dialogs (hideCreateCustomer and hideCreateProduct turn them off). Takes header actions, banners, aside cards, the empty lines note and the error state as plain nodes.
Page: A complete screen for one route, such as a bill or the invoices list. Mount it on a route in your app; connected SDK pages provide data and actions; standalone UI pages receive them as props. 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/ar-edit-invoice-pageAlso installs: button, base-theme, base-page, base-states, ar-invoice-form, ar-invoice-lines-editor, ar-invoice-discount, ar-send-invoice-dialog, ar-create-customer-dialog, ar-create-product-dialog, ui-ar-edit-invoice-page, ui-ar-invoice-form.
Usage
import { EditInvoicePage } from "@/components/dolfin/ar/edit-invoice-page";
// A whole screen: mount it on a route, inside your <DolfinProvider>.
export default function Route({ params }: { params: { invoiceId: string } }) {
return <EditInvoicePage invoiceId={params.invoiceId} />;
}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 |
|---|---|---|
invoiceId required | string | |
onNavigate | (route: DolfinRoute) => void | Replaces the provider's navigation (back, cancel and after saving). |
onSaved | (invoice: Invoice) => void | Called with the saved invoice before the page goes back to it. |
hideSend | boolean | Hides "Save and send" (the invoice can still be sent from its page). |
hideCreateCustomer | boolean | Hides "New Customer" in the customer picker (the page otherwise opens the create-customer dialog). |
hideCreateProduct | boolean | Hides "New Product" in the product pickers (the page otherwise opens the create-product dialog). |
onFix | (fix: InvoiceSendFix) => void | Where a send problem is fixed; see the send dialog. |
canFix | (fix: InvoiceSendFix) => boolean | |
headerActions | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Buttons beside the title. |
banners | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Above the form: notices such as missing bank details. |
aside | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Cards under the summary. |
emptyState | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Replaces the note shown when there are no lines. |
errorState | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Replaces the not-found, load error and not-editable state. |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
ar.invoiceDraft
Or edit the installed file directly: it is your code. See theming for colours and fonts.
Hooks
The SDK hooks this page uses. Use them directly from @dolfinai/react to build your own version.
useDolfinNavigateuseInvoiceDraftuseInvoiceDraftLookupsuseMessagesFiles
Written to your app by the install command:
components/dolfin/ar/edit-invoice-page.tsx246 lines