dolfindevelopers

Customer form

ComponentReceivablesSDK + UI

The customer fields shared by the create and edit dialogs: name, email, phone, tax number and an address with state and a country picker, with client-side checks and the API's field errors beside their fields.

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

Works with Dolfin’s SDK context, 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/ar-customer-form

Also installs: input, label, base-theme, ap-supplier-form, ui-ar-customer-form.

Usage

screen.tsx
import { ArCustomerFormFields } from "@/components/dolfin/ar/customer-form";

// Place it anywhere inside your <DolfinProvider>.
<ArCustomerFormFields values={values} onChange={handleChange} />

Renders inside DolfinProvider (set it up once). It renders the data you pass as props.

API reference

PropTypeDescription
values requiredCustomerFormValue
onChange required(next: CustomerFormValue) => void
errorsReadonly<Record<string, string | undefined>>Messages by field: `name`, `email`, `address.city`, ...
idPrefixstringPrefix for input ids (`customer` gives `customer-name`); keep it unique per page.
autoFocusboolean
inDialogboolean
disabledboolean
hideAddressboolean
countriesreadonly CodeOption[]The countries to offer (ISO code and name), instead of loading them.
childrenstring | 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 the host manages).
classNamestring

Customisation

Without editing the source, you can change:

Class names
className
Messages
ap.suppliers.formar.customers.formcore.errors

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.

useMessages

Files

Written to your app by the install command:

  • components/dolfin/ar/customer-form.tsx 168 lines
  • components/dolfin/ar/customer-address-fields.tsx 98 lines