dolfindevelopers

Approval policies list

ComponentPayablesSDK + UI

Bill approval policies in evaluation order: priority, name, conditions in words, the suppliers it applies to, the action, who approves, and an active switch. Edit and Delete row actions with a confirmation, and the fall-through rule stated under the table. Read-only without the manageApprovalPolicies permission. Takes columns and rowActions.

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/ap-approval-policies-list

Also installs: alert-dialog, badge, button, switch, base-data-table, base-info-hint, base-states, base-status-badge, ui-ap-approval-policies-list.

Usage

screen.tsx
import { ApprovalPoliciesList } from "@/components/dolfin/ap/approval-policies-list";

// Place it anywhere inside your <DolfinProvider>.
<ApprovalPoliciesList />

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
policiesreadonly ApprovalPolicy[]The policies to show, in evaluation order. Passing them (or `loading` / `error`) fetches nothing.
loadingboolean
errorError
onRetry() => void
supplierNamesReadonly<Record<string, string>>Supplier names by id, for "Applies to".
peopleNamesReadonly<Record<string, string>>Approver names by user id.
onToggleActive(policy: ApprovalPolicy, active: boolean) => voidMakes the Active switch work. Wired for you (with the role check) when the list fetches.
onDelete(policy: ApprovalPolicy) => voidShows Delete, behind a confirmation. Wired for you (with the role check) when the list fetches.
pendingIdstringThe policy a change is running for.
onEdit(policy: ApprovalPolicy) => voidOpens the policy form for a row; without it there is no Edit action.
onCreate() => voidShows "New policy" in the empty state.
columnsApprovalPolicyColumnsProp
columnOrderreadonly string[]
columnVisibilityReadonly<Record<string, boolean>>
rowActionsApprovalPolicyRowActionsPropPass `[]` for none.
emptyStatestring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Replaces the empty state.
hideFallThroughbooleanHides the note under the table on what happens when no policy matches.
classNamestring

Customisation

Without editing the source, you can change:

Class names
className
Messages
ap.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.

useApprovalPoliciesuseApprovalPolicyFormatuseApprovalPolicyMutationsuseApprovalPolicySupplierNamesuseBillReviewersuseMessagesusePermissions

Files

Written to your app by the install command:

  • components/dolfin/ap/approval-policies-list.tsx 372 lines