Customer form
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
Works with Dolfin’s SDK context, 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-customer-formAlso installs: input, label, base-theme, ap-supplier-form, ui-ar-customer-form.
Usage
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
| Prop | Type | Description |
|---|---|---|
values required | CustomerFormValue | |
onChange required | (next: CustomerFormValue) => void | |
errors | Readonly<Record<string, string | undefined>> | Messages by field: `name`, `email`, `address.city`, ... |
idPrefix | string | Prefix for input ids (`customer` gives `customer-name`); keep it unique per page. |
autoFocus | boolean | |
inDialog | boolean | |
disabled | boolean | |
hideAddress | boolean | |
countries | readonly CodeOption[] | The countries to offer (ISO code and name), instead of loading them. |
children | 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 the host manages). |
className | string |
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.
useMessagesFiles
Written to your app by the install command:
components/dolfin/ar/customer-form.tsx168 linescomponents/dolfin/ar/customer-address-fields.tsx98 lines