Bulk upload products dialog
Create many products from a CSV: drop or pick a file, download a template, see every bad cell before anything is sent and a preview of what will be created, then upload. Files over the API's caps go in parts; partial failures list each refused row by its row in the file and offer the rows not created as a CSV to fix, with a retry for parts that failed in transit.
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/ar-bulk-upload-products-dialogAlso installs: button, dialog, label, table, base-theme, base-money, ui-ar-bulk-upload-products-dialog.
Usage
import { ArBulkUploadProductsDialog } from "@/components/dolfin/ar/bulk-upload-products-dialog";
// Place it anywhere inside your <DolfinProvider>.
<ArBulkUploadProductsDialog 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 | |
onUploaded | (result: ProductUploadResult) => void | After an upload created at least one product. The dialog closes on full success. |
batchSize | number | Rows per request (at most 1000). |
previewRows | number | Rows shown in the preview. Defaults to 5. |
help | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Below the columns help (e.g. a link to the host's own import guide). |
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… | |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
ar.products
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.
useMessagesuseProductBulkUploadFiles
Written to your app by the install command:
components/dolfin/ar/bulk-upload-products-dialog.tsx182 linescomponents/dolfin/ar/bulk-upload-parts.tsx80 lines