Product detail page
One product: back link, header with its type, price per unit, Edit and Delete, then what an invoice line shows (description, type, unit price, currency) and the record (id, created, last updated). Plain node props for header actions, extra detail cards, an aside, the not-found state 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-product-detail-pageAlso installs: button, base-theme, base-page, base-states, base-money, base-info-hint, ar-edit-product-dialog, ar-product-delete-dialog, ui-ar-product-detail-page.
Usage
import { ArProductDetailPage } from "@/components/dolfin/ar/product-detail-page";
// A whole screen: mount it on a route, inside your <DolfinProvider>.
export default function Route({ params }: { params: { productId: string } }) {
return <ArProductDetailPage productId={params.productId} />;
}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 |
|---|---|---|
productId 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. the income account it posts to, recent invoices using it). |
aside | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | A column beside the product 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. |
readOnly | boolean | Hide Edit and Delete. |
hideBackLink | boolean | |
onNavigate | (route: DolfinRoute) => void | Overrides the provider's navigation (after a delete, back to the products list). |
onDeleted | (productId: string) => void | After the product was deleted. Defaults to opening the products list. |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
ar.products
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.
useCanManageProductsuseDolfinLocaleuseDolfinNavigateuseMessagesuseProductFiles
Written to your app by the install command:
components/dolfin/ar/product-detail-page.tsx242 lines