Supplier form
The supplier fields shared by the create and edit dialogs: name, email, phone, website, payment terms, tax and registration numbers, address with a country picker, and bank details whose fields follow the bank country (UK sort code and account number, IBAN, BIC, routing number), with client-side checks and the API's field errors.
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
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/ap-supplier-formAlso installs: button, input, label, popover, command, base-theme, base-states, ui-ap-supplier-form.
Usage
import { SupplierFormFields } from "@/components/dolfin/ap/supplier-form";
// Place it anywhere inside your <DolfinProvider>.
<SupplierFormFields values={values} onChange={handleChange} />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 |
|---|---|---|
values required | SupplierFormValue | |
onChange required | (next: SupplierFormValue) => void | |
errors | Readonly<Record<string, string | undefined>> | Messages by field: `name`, `email`, `address.city`, `bankDetails.sortCode`, ... |
idPrefix | string | Prefix for input ids (`supplier` gives `supplier-name`); keep it unique per page. |
autoFocus | boolean | |
inDialog | boolean | |
disabled | boolean | |
hideAddress | boolean | |
hideBankDetails | boolean | |
countries | readonly CodeOption[] | Your countries and currencies for the pickers. Given, those lists are not fetched. |
currencies | readonly { id?: string; code: string; name: string; symbol: string; decimalPlaces?: number | string; }[] | |
bankProfiles | Readonly<Record<string, { countryCode: string; countryName: string; defaultCurrencies: string[]; accountHolderName: components["schemas"]["B… | Your bank profiles by country code. Given, or with your `countries`, no profile is fetched. |
children | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Extra fields after the bank details. |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
ap.suppliers.formbase.statescore.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.
useBankCountriesuseBankCountryProfileuseBankCurrenciesuseMessagesFiles
Written to your app by the install command:
components/dolfin/ap/supplier-form.tsx192 linescomponents/dolfin/ap/address-fields.tsx92 linescomponents/dolfin/ap/bank-details-fields.tsx161 linescomponents/dolfin/ap/country-combobox.tsx171 lines