Expense policy documents
Upload the written expense policy (PDF, Word .docx or text, by drop or browse) and see every version: its status while it is read into proposed policies (polling until done, or showing it as taking longer than usual with Check again once it stalls), how many policies and unenforceable clauses it yielded, and Review, View or Retry. Also ships the document status badge. Driven by useExpensePolicyDocuments. Pass documents (with loading, error, onUpload and onRetryDocument) to render your own list without a request.
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/expenses-policy-documents-panelAlso installs: button, card, base-theme, base-data-table, base-info-hint, base-states, base-status-badge, ui-expenses-policy-documents-panel, ui-base-data-table.
Usage
import { ExpensePolicyDocumentsPanel } from "@/components/dolfin/expenses/policy-documents-panel";
// Place it anywhere inside your <DolfinProvider>.
<ExpensePolicyDocumentsPanel />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 |
|---|---|---|
documents | readonly { id: string; version: number | string; fileName: string; contentType: string; sizeBytes?: number | string; pageCount?: null | numb… | Your documents, newest first: rendered as given and nothing is fetched. Read when omitted. |
loading | boolean | |
error | Error | |
onRetry | () => void | |
onUpload | (file: File) => void | Shows the drop zone; called with the one file dropped or picked. Wired to the SDK by default. |
uploading | boolean | |
onRetryDocument | (documentId: string) => void | Shows Retry on a document that failed to read. Wired to the SDK by default. |
pendingId | string | The document a retry is running for: its Retry waits. |
columns | readonly Column[] | ((defaults: Column[]) => readonly Column[]) | Replaces the default columns (version, file, status, found, uploaded). |
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 component uses. Use them directly from @dolfinai/react to build your own version.
useDolfinLocaleuseExpensePolicyDocumentMutationsuseExpensePolicyDocumentsuseExpensePolicyFormatuseMessagesuseNotifyFiles
Written to your app by the install command:
components/dolfin/expenses/policy-documents-panel.tsx346 lines