Create invoice page
A new invoice: customer, currency, memo, CC and payment terms, then the lines, discounts and live totals with the early payment price. Saved as a draft (then opens the invoice) or created and sent through the send dialog. New Customer and New Product open the create dialogs and put the result on the invoice (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-create-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-create-invoice-page, ui-ar-invoice-form.
Usage
import { ArCreateInvoicePage } from "@/components/dolfin/ar/create-invoice-page";
// A whole screen: mount it on a route, inside your <DolfinProvider>.
export default function Route() {
return <ArCreateInvoicePage />;
}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 |
|---|---|---|
initial | { customerId?: string; customerName?: string; currency?: string; } | Starting values (for example, invoicing from a customer's page). |
onNavigate | (route: DolfinRoute) => void | Replaces the provider's navigation (back, cancel and the new invoice). |
onCreated | (invoice: Invoice) => void | Called with the new invoice before the page moves on to it. |
hideSend | boolean | Hides "Create 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 load error 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/create-invoice-page.tsx219 lines