dolfindevelopers

Receipt upload

ComponentExpensesSDK + UI

A drop zone for receipts: drop PDFs or photos, or click to browse. Up to ten at once, uploaded one at a time with progress; files that are not PDFs or images are skipped and reported. Dolfin reads each receipt, then pairs it with its card transaction.

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-upload

Also installs: progress, base-theme, ui-expenses-receipt-upload.

Usage

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

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

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
onUpload(files: File[]) => voidHandle the dropped files yourself: nothing is uploaded by the zone then. Pair it with `uploading`, `progress` and `error`.
uploadingboolean
progress{ done: number; total: number; }Files done out of the batch, while `uploading`.
errorError
onUploaded(batch: ReceiptUploadBatch) => voidAfter every batch that uploaded at least one receipt.
notifybooleanReport the result through the provider's `notify`. Defaults to true.
inputRef((instance: HTMLInputElement | null) => void | (() => VoidOrUndefinedOnly) | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUE…The file input, so another control (an Upload button) can open the picker.
childrenstring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Replaces the idle content ("Drop receipts here, or click to browse").
classNamestring

Customisation

Without editing the source, you can change:

Class names
className
Messages
core.errorsexpenses.receipts.upload

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.

useMessagesuseNotifyuseReceiptUpload

Files

Written to your app by the install command:

  • components/dolfin/expenses/receipt-upload.tsx 95 lines