dolfindevelopers

Policy document proposal card

ComponentExpensesSDK + UI

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

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-proposals

Also installs: badge, button, card, base-theme, base-status-badge, expenses-approval-policy-fields, ui-expenses-policy-document-proposals.

Usage

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

PropTypeDescription
state requiredExpensePolicyProposalState
editable requiredbooleanThe reviewer may edit, include and leave out proposals.
referenceData requiredExpensePolicyReferenceData
onDraftChange required(draft: ExpensePolicyDraft) => void
onToggleEditing required() => void
onToggleIncluded required() => void
classNamestring

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.

useExpensePolicyFormatuseMessages

Files

Written to your app by the install command:

  • components/dolfin/expenses/policy-document-proposals.tsx 167 lines