Policy document proposal card
One approval policy proposed from an uploaded expense policy: its name and whether it is new, changed or unchanged, the clause it enforces, the rule in short, what must be fixed or checked before confirming, and Edit (the policy fields inline), Leave out and Include. Also ships the clause quote, the rule readout and the change badge.
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-document-proposalsAlso installs: badge, button, card, base-theme, base-status-badge, expenses-approval-policy-fields, ui-expenses-policy-document-proposals.
Usage
import { ExpensePolicyProposalCard } from "@/components/dolfin/expenses/policy-document-proposals";
// Place it anywhere inside your <DolfinProvider>.
<ExpensePolicyProposalCard state={state} editable={editable} referenceData={referenceData} onDraftChange={handleDraftChange} onToggleEditing={handleToggleEditing} onToggleIncluded={handleToggleIncluded} />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 |
|---|---|---|
state required | ExpensePolicyProposalState | |
editable required | boolean | The reviewer may edit, include and leave out proposals. |
referenceData required | ExpensePolicyReferenceData | |
onDraftChange required | (draft: ExpensePolicyDraft) => void | |
onToggleEditing required | () => void | |
onToggleIncluded required | () => void | |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
expenses.approvalPolicies.document
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.
useExpensePolicyFormatuseMessagesFiles
Written to your app by the install command:
components/dolfin/expenses/policy-document-proposals.tsx167 lines