Upload bills dialog
A drop zone and file picker for supplier invoices (PDF, PNG, JPG; up to 10 at once) with progress and inline errors, plus the same in a dialog. A single upload opens the new bill. The drop zone takes an idle slot, its own class and a single-file mode; the dialog can stay open after an upload.
Dialog: a modal you open from your own screen. You control when it opens with its props. 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-upload-dialogAlso installs: dialog, progress, base-theme, ui-ap-bill-upload-dialog.
Usage
import { ApBillUploadDialog } from "@/components/dolfin/ap/bill-upload-dialog";
// Place it anywhere inside your <DolfinProvider>.
<ApBillUploadDialog open={open} onOpenChange={handleOpenChange} />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 |
|---|---|---|
open required | boolean | |
onOpenChange required | (open: boolean) => void | |
upload | BillUpload | A `useBillUpload` result owned by the caller. |
onUploaded | (batch: BillUploadBatch) => void | After every batch that created at least one bill; the dialog closes first. |
openOnSuccess | boolean | Open the new bill after a single-file upload. Defaults to true. |
onNavigate | (route: DolfinRoute) => void | |
title | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | |
description | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | |
footer | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Rendered under the drop zone, e.g. the address of a bills inbox. |
closeOnSuccess | boolean | Close once a batch created a bill. Defaults to true; false keeps it open (e.g. to show a next step). |
multiple | boolean | Passed to the drop zone: several files at once (default true), its idle content, its class. |
dropzoneIdle | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Replaces what the drop zone shows while idle. |
dropzoneClassName | string | |
className | string |
Customisation
Without editing the source, you can change:
- Class names
dropzoneClassNameclassName- Messages
ap.bills.uploadcore.errors
Or edit the installed file directly: it is your code. See theming for colours and fonts.
Hooks
The SDK hooks this dialog uses. Use them directly from @dolfinai/react to build your own version.
useBillUploaduseDolfinNavigateuseMessagesuseNotifyFiles
Written to your app by the install command:
components/dolfin/ap/bill-upload-dialog.tsx85 linescomponents/dolfin/ap/bill-upload-dropzone.tsx156 lines