Bill header and actions
BillHeader: the bar above a bill (back, edit, e-invoice badge, re-classify, match, refresh). BillActions: the primary actions for the bill's state (submit for review, approve, reject, reopen, retry extraction, void) behind confirmations (the SDK's own ask first; a host onX replaces them and runs at once), disabled with the reason (submitReviewDisabledReason, approveDisabledReason, ...) when the role can't take them.
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/ap-bill-headerAlso installs: button, badge, popover, textarea, base-info-hint, base-states, ap-submit-review-dialog, ui-ap-bill-header.
Usage
import { BillHeader } from "@/components/dolfin/ap/bill-header";
// Place it anywhere inside your <DolfinProvider>.
<BillHeader />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 |
|---|---|---|
billId | string | Fetches the bill (sharing the bill page's cache) and wires Re-classify and Refresh. |
bill | { id?: string; organisationId?: string; state?: components["schemas"]["BillState"]; source?: components["schemas"]["BillSource"]; eInvoiceId… | Your bill. Passing it (or `loading` or `error`) fetches nothing, and Re-classify and Refresh show only with their callbacks. `null` reads as not found. Given with `billId`, the bill wins. |
loading | boolean | |
error | Error | |
onRetry | () => void | Shows "Try again" in the error state. |
onReclassify | () => void | Shows Re-classify (lines nobody confirmed) where the bill allows it. By id, yours replaces the SDK's. |
onRefresh | () => void | Re-reads the bill (shown while it is still being extracted). By id, yours replaces the SDK's. |
pendingAction | BillHeaderAction | The header action running now: its button shows progress, and the other waits. |
children | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Extra buttons on the right (the page's `headerActions` slot). |
onNavigate | (route: DolfinRoute) => void | Replaces provider navigation for the back, edit and match links. |
hideMatch | boolean | Hides the Match link (for hosts without matching; it also hides when `navigation.href` returns null for it). |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
ap.billbase.infoHintbase.statescore.errors
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.
useBilluseBillActionsuseBillPermissionsuseBillSupplieruseDolfinHasRouteuseMessagesFiles
Written to your app by the install command:
components/dolfin/ap/bill-header.tsx214 linescomponents/dolfin/ap/bill-actions.tsx275 lines