Receipt detail
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
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/expenses-receipt-detailAlso 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
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
| Prop | Type | Description |
|---|---|---|
receiptId | string | Read 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. |
loading | boolean | |
error | Error | |
onRetry | () => void | |
fileUrl | string | Data mode: the file's link, for the preview and View file. |
candidates | readonly { 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) => void | Shows Match on each candidate. Wired to the SDK in id mode. |
onReadAgain | () => void | Shows Read again. Wired to the SDK in id mode; yours replaces it. |
pendingAction | "readAgain" | The action running: Read again shows a spinner. |
headerActions | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Buttons after View file and Read again. |
fields | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Extra fields in "What we read". |
sections | string | 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 | null | Where "Open the expense" goes; the expense page by default. Return null to hide it. |
before | string | 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). |
className | string |
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.
useDolfinLocaleuseMessagesuseReceiptuseReceiptFileuseReceiptMutationsFiles
Written to your app by the install command:
components/dolfin/expenses/receipt-detail.tsx282 linescomponents/dolfin/expenses/receipt-cards.tsx204 lines