dolfindevelopers

Bill document viewer

ComponentPayablesSDK + UI

The bill's original PDF or image beside its details, from a fresh signed link, with loading, empty and error states.

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/ap-bill-document-viewer

Also installs: base-document-viewer, ui-ap-bill-document-viewer.

Usage

screen.tsx
import { BillDocumentViewer } from "@/components/dolfin/ap/bill-document-viewer";

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

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
billIdstringFetches a fresh signed link to the bill's document. Leave it out and pass `url` to show your own.
billPick<{ id?: string; organisationId?: string; state?: components["schemas"]["BillState"]; source?: components["schemas"]["BillSource"]; eInvo…The bill, when you already have it; otherwise the viewer reads it (shared with the bill page's cache).
urlstringThe document to show; null for none. Passing it (or `loading` / `error`) fetches nothing.
fileTypestring"pdf" or an image type; guessed from the URL when left out.
loadingboolean
errorError
onRetry() => void
showOpenLinkbooleanShows an "Open in new tab" link above the document.
classNamestring

Customisation

Without editing the source, you can change:

Class names
className
Messages
ap.bill.documentbase.documentViewerbase.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.

useBillDocumentuseMessages

Files

Written to your app by the install command:

  • components/dolfin/ap/bill-document-viewer.tsx 75 lines