Invoice header and actions
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
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-invoice-headerAlso installs: button, dialog, base-info-hint, base-money, base-status-badge, base-states, ar-send-invoice-dialog, ui-ar-invoice-header.
Usage
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
| Prop | Type | Description |
|---|---|---|
invoiceId | string | Loads 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. |
loading | boolean | |
error | Error | |
onRetry | () => void | |
onEdit | () => void | Shows Edit (drafts). |
editDisabledReason | string | Why Edit is unavailable; disables it and says why beside it. |
onDelete | () => Promise<unknown> | void | Shows Delete (drafts). Yours runs at once; by id, the SDK's own Delete asks first. |
deleteDisabledReason | string | Why Delete is unavailable; disables it and says why beside it. |
children | string | 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) => void | Replaces provider navigation for the back and customer links (and Edit, by id). |
onDeleted | () => void | Called once a draft is deleted. By id, defaults to the invoices list. |
className | string |
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.
useDolfinLocaleuseDolfinNavigateuseInvoiceuseInvoiceActionsuseInvoicePdfuseInvoicePermissionsuseMessagesFiles
Written to your app by the install command:
components/dolfin/ar/invoice-header.tsx155 linescomponents/dolfin/ar/invoice-actions.tsx203 linescomponents/dolfin/ar/invoice-action-confirm.tsx29 lines