Customer detail page
One customer: back link, header with contact line, Edit and Delete, what they owe and how much is overdue, contact, address and record cards, then tabs for the customer's invoices and credit notes. Plain node props for header actions, extra detail cards (e-invoicing, WhatsApp), the invoices and credit notes tabs, more tabs, an aside and extra form fields.
Page: A complete screen for one route, such as a bill or the invoices list. Mount it on a route in your app; connected SDK pages provide data and actions; standalone UI pages receive them as 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-customer-detail-pageAlso installs: button, tabs, base-theme, base-page, base-states, base-info-hint, ar-customer-details, ar-edit-customer-dialog, ar-customer-delete-dialog, ui-ar-customer-detail-page.
Usage
import { ArCustomerDetailPage } from "@/components/dolfin/ar/customer-detail-page";
// A whole screen: mount it on a route, inside your <DolfinProvider>.
export default function Route({ params }: { params: { customerId: string } }) {
return <ArCustomerDetailPage customerId={params.customerId} />;
}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 |
|---|---|---|
customerId required | string | |
headerActions | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Beside the Edit and Delete buttons. |
details | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Extra cards in the details grid (e.g. e-invoicing address, WhatsApp settings). |
invoices | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | The Invoices tab's content (e.g. an invoices table filtered to this customer). No tab without it. |
creditNotes | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | The Credit notes tab's content. No tab without it. |
tabs | ArCustomerDetailPageTabSlot[] | More tabs after the built-in ones. |
aside | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | A column beside the customer on wide pages. |
emptyState | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Replaces the not-found state. |
formFields | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Extra fields in the edit dialog. |
hideBalance | boolean | Leave out the owed and overdue strip. |
readOnly | boolean | Hide Edit and Delete. |
defaultTab | string | |
hideBackLink | boolean | |
onNavigate | (route: DolfinRoute) => void | Overrides the provider's navigation (after a delete, back to the customers list). |
onDeleted | (customerId: string) => void | After the customer was deleted. Defaults to opening the customers list. |
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 page uses. Use them directly from @dolfinai/react to build your own version.
useCanManageCustomersuseCustomeruseDolfinNavigateuseMessagesFiles
Written to your app by the install command:
components/dolfin/ar/customer-detail-page.tsx247 lines