dolfindevelopers

Receipt detail

ComponentExpensesSDK + UI

One receipt: header with total, date, extraction and match badges, View file and Read again; notices for an unreadable receipt, one still being read and a missing VAT number; the file beside what was read (merchant, VAT number, address, number, date, tip, VAT and total) and its card transaction or match candidates; then the lines. ReactNode props for header actions, extra fields and extra sections. Exports each card for your own layout. Fetches by receiptId; pass receipt (with loading, error, fileUrl and candidates) to render your own data without a request.

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/expenses-receipt-detail

Also installs: button, card, expenses-receipt-match-card, expenses-receipt-parts, expenses-receipt-preview, base-data-table, base-info-hint, base-money, base-page, base-states, base-theme, ui-expenses-receipt-detail.

Usage

screen.tsx
import { ReceiptDetail } from "@/components/dolfin/expenses/receipt-detail";

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

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
receiptIdstringRead the receipt (and its file and match candidates) by id.
receipt{ id?: string; organisationId?: string; fileName?: null | string; contentType?: null | string; fileSizeBytes?: number | string; source?: com…The receipt you already hold: rendered as given, nothing is fetched.
loadingboolean
errorError
onRetry() => void
fileUrlstringData mode: the file's link, for the preview and View file.
candidatesreadonly { cardTransactionId?: null | string; expenseId?: null | string; receiptId?: null | string; score?: number | string; withinAmountTol…Data mode: the card transactions an unmatched receipt could belong to.
onMatch(expenseId: string) => voidShows Match on each candidate. Wired to the SDK in id mode.
onReadAgain() => voidShows Read again. Wired to the SDK in id mode; yours replaces it.
pendingAction"readAgain"The action running: Read again shows a spinner.
headerActionsstring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Buttons after View file and Read again.
fieldsstring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Extra fields in "What we read".
sectionsstring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Extra cards after the lines (e.g. the expense's accounting sync).
getExpenseRoute(expenseId: string) => DolfinRoute | nullWhere "Open the expense" goes; the expense page by default. Return null to hide it.
beforestring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Rendered above the header in every state (e.g. a back link).
classNamestring

Customisation

Without editing the source, you can change:

Class names
className
Messages
expenses.receipts

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.

useDolfinLocaleuseMessagesuseReceiptuseReceiptFileuseReceiptMutations

Files

Written to your app by the install command:

  • components/dolfin/expenses/receipt-detail.tsx 282 lines
  • components/dolfin/expenses/receipt-cards.tsx 204 lines