Edit customer dialog
Edit a customer's name, contact details, tax number and address in a dialog. Settings the form does not show (e-invoicing address, WhatsApp) are kept as they are; a fields prop and a request hook let the host edit them.
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-edit-customer-dialogAlso installs: button, dialog, base-theme, ar-customer-form, ui-ar-edit-customer-dialog.
Usage
import { ArEditCustomerDialog } from "@/components/dolfin/ar/edit-customer-dialog";
// Place it anywhere inside your <DolfinProvider>.
<ArEditCustomerDialog customer={customer} 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 |
|---|---|---|
customer required | { id?: string; organisationId?: string; name: string; email?: null | string; phone?: null | string; taxNumber?: null | string; addressLine1?… | The customer to edit; the form is filled from it each time the dialog opens. |
open required | boolean | |
onOpenChange required | (open: boolean) => void | |
onUpdated | (customer: Customer) => void | After the save; the dialog has closed. |
transformRequest | (body: UpdateCustomerRequest) => UpdateCustomerRequest | Adjust the request before it is sent, e.g. to add the values of your `fields`. |
onSubmit | (body: UpdateCustomerRequest) => Promise<Customer | void> | void | Saves the changes yourself instead of the SDK. The dialog closes once it resolves and shows the error in place if it rejects. |
submitting | boolean | Your own save is running. |
countries | readonly CodeOption[] | The countries to offer (ISO code and name), instead of loading them. |
fields | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Extra fields after the address (e.g. e-invoicing or WhatsApp settings); pair with `transformRequest`. |
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… | |
hideAddress | boolean | |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
ar.customers
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.
useCustomerMutationsuseMessagesFiles
Written to your app by the install command:
components/dolfin/ar/edit-customer-dialog.tsx130 lines