dolfindevelopers

Expense policy document page

PageExpensesSDK + UI

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

Choose your integration

Ready to connect to Dolfin. Loads data through SDK hooks, with appearance and behaviour you can customise. Requires DolfinProvider.

Loading preview…

Installation

Needs the Dolfin registry token. The CLI copies the source into your app.

Terminal
bunx --bun shadcn@4.23.0 add @dolfin/expenses-policy-document-page

Also installs: button, base-page, base-states, expenses-policy-document-review, expenses-policy-documents-panel, ui-expenses-policy-document-page.

Usage

route.tsx
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

PropTypeDescription
documentId requiredstring
headerActionsstring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Beside the status badge.
asidestring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…A column beside the review.
hideBackLinkbooleanHide the "Back to approval policies" link.
onConfirmed() => voidAfter the document is confirmed. Defaults to going back to the approval policies.
classNamestring

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.

useDolfinLocaleuseDolfinNavigateuseExpensePolicyDocumentuseExpensePolicyDocumentMutationsuseExpensePolicyFormatuseMessages

Files

Written to your app by the install command:

  • components/dolfin/expenses/policy-document-page.tsx 190 lines