dolfindevelopers

Edit supplier dialog

DialogPayablesSDK + UI

Edit a supplier's contact details, terms, address and bank details in a dialog, with client-side checks and the API's field errors. Changing the account clears its pay-by-bank confirmation.

Dialog: a modal you open from your own screen. You control when it opens with its props. 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/ap-edit-supplier-dialog

Also installs: button, dialog, base-theme, ap-supplier-form, ui-ap-edit-supplier-dialog.

Usage

screen.tsx
import { ApEditSupplierDialog } from "@/components/dolfin/ap/edit-supplier-dialog";

// Place it anywhere inside your <DolfinProvider>.
<ApEditSupplierDialog supplier={supplier} 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

PropTypeDescription
supplier required{ id?: string; organisationId?: string; name: string; email?: null | string; phone?: null | string; website?: null | string; taxNumber?: nul…The supplier to edit; the form is filled from it each time the dialog opens.
open requiredboolean
onOpenChange required(open: boolean) => void
onUpdated(supplier: Supplier) => voidAfter the save; the dialog has closed.
onSubmit(values: SupplierFormValue) => void | Promise<unknown>Saves the changes yourself: called with the validated form instead of updating through the API. Resolve to close the dialog; reject (or set `error`) to keep it open.
submittingbooleanYour save is running.
errorErrorWhy your save failed, shown above the button.
titlestring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…
descriptionstring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…
hideAddressboolean
hideBankDetailsboolean
countriesreadonly CodeOption[]Your countries and currencies for the pickers. Given, those lists are not fetched.
currenciesreadonly { id?: string; code: string; name: string; symbol: string; decimalPlaces?: number | string; }[]
bankProfilesReadonly<Record<string, { countryCode: string; countryName: string; defaultCurrencies: string[]; accountHolderName: components["schemas"]["B…Your bank profiles by country code. Given, or with your `countries`, no bank profile is fetched.
classNamestring

Customisation

Without editing the source, you can change:

Class names
className
Messages
ap.supplierscore.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.

useMessagesuseSupplierMutations

Files

Written to your app by the install command:

  • components/dolfin/ap/edit-supplier-dialog.tsx 170 lines