dolfindevelopers

Create invoice page

PageReceivablesSDK + UI

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

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/ar-create-invoice-page

Also 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

route.tsx
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

PropTypeDescription
initial{ customerId?: string; customerName?: string; currency?: string; }Starting values (for example, invoicing from a customer's page).
onNavigate(route: DolfinRoute) => voidReplaces the provider's navigation (back, cancel and the new invoice).
onCreated(invoice: Invoice) => voidCalled with the new invoice before the page moves on to it.
hideSendbooleanHides "Create and send" (the invoice can still be sent from its page).
hideCreateCustomerbooleanHides "New Customer" in the customer picker (the page otherwise opens the create-customer dialog).
hideCreateProductbooleanHides "New Product" in the product pickers (the page otherwise opens the create-product dialog).
onFix(fix: InvoiceSendFix) => voidWhere a send problem is fixed; see the send dialog.
canFix(fix: InvoiceSendFix) => boolean
headerActionsstring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Buttons beside the title.
bannersstring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Above the form: notices such as missing bank details.
asidestring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Cards under the summary.
emptyStatestring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Replaces the note shown when there are no lines.
errorStatestring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Replaces the load error state.
classNamestring

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.

useDolfinNavigateuseInvoiceDraftuseInvoiceDraftLookupsuseMessages

Files

Written to your app by the install command:

  • components/dolfin/ar/create-invoice-page.tsx 219 lines