Expense policy document page
One uploaded version of the expense policy: back link, header with the file, upload and confirmation dates and status; a waiting state that updates on its own while the document is read, and a stalled state with Check again once reading runs far past its usual time; the failure reason with Retry; and once read, the review of its proposed policies with Confirm policies (back to the approval policies afterwards). ReactNode props for header actions and an aside.
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/expenses-policy-document-pageAlso installs: button, base-page, base-states, expenses-policy-document-review, expenses-policy-documents-panel, ui-expenses-policy-document-page.
Usage
import { ExpensePolicyDocumentPage } from "@/components/dolfin/expenses/policy-document-page";
// A whole screen: mount it on a route, inside your <DolfinProvider>.
export default function Route({ params }: { params: { documentId: string } }) {
return <ExpensePolicyDocumentPage documentId={params.documentId} />;
}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 |
|---|---|---|
documentId required | string | |
headerActions | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Beside the status badge. |
aside | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | A column beside the review. |
hideBackLink | boolean | Hide the "Back to approval policies" link. |
onConfirmed | () => void | After the document is confirmed. Defaults to going back to the approval policies. |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
expenses.approvalPolicies
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.
useDolfinLocaleuseDolfinNavigateuseExpensePolicyDocumentuseExpensePolicyDocumentMutationsuseExpensePolicyFormatuseMessagesFiles
Written to your app by the install command:
components/dolfin/expenses/policy-document-page.tsx190 lines