dolfindevelopers

Invoice header and actions

ComponentReceivablesSDK + UI

InvoiceHeader: the bar above an invoice (back, edit, delete a draft) and who it is for, its number, state pill, total and what is owed. InvoiceActions: the primary actions for the invoice's state (send, issue without sending, send a reminder, download the PDF, void) behind confirmations, disabled with the reason when the role or state rules them out, and waiting while one runs.

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/ar-invoice-header

Also installs: button, dialog, base-info-hint, base-money, base-status-badge, base-states, ar-send-invoice-dialog, ui-ar-invoice-header.

Usage

screen.tsx
import { InvoiceHeader } from "@/components/dolfin/ar/invoice-header";

// Place it anywhere inside your <DolfinProvider>.
<InvoiceHeader />

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
invoiceIdstringLoads the invoice and wires Edit and Delete from the role and the invoice's state.
invoice{ id?: string; organisationId?: string; customerId?: string; documentNumber?: null | string; currency: string; issueDate?: string; dueDate?:…Your own invoice: the header then makes no request. `null` reads as not found.
loadingboolean
errorError
onRetry() => void
onEdit() => voidShows Edit (drafts).
editDisabledReasonstringWhy Edit is unavailable; disables it and says why beside it.
onDelete() => Promise<unknown> | voidShows Delete (drafts). Yours runs at once; by id, the SDK's own Delete asks first.
deleteDisabledReasonstringWhy Delete is unavailable; disables it and says why beside it.
childrenstring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Extra buttons on the right of the bar.
onNavigate(route: DolfinRoute) => voidReplaces provider navigation for the back and customer links (and Edit, by id).
onDeleted() => voidCalled once a draft is deleted. By id, defaults to the invoices list.
classNamestring

Customisation

Without editing the source, you can change:

Class names
className
Messages
ar.invoicebase.infoHint.moreAbout

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.

useDolfinLocaleuseDolfinNavigateuseInvoiceuseInvoiceActionsuseInvoicePdfuseInvoicePermissionsuseMessages

Files

Written to your app by the install command:

  • components/dolfin/ar/invoice-header.tsx 155 lines
  • components/dolfin/ar/invoice-actions.tsx 203 lines
  • components/dolfin/ar/invoice-action-confirm.tsx 29 lines