Approval policies list
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
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/ap-approval-policies-listAlso installs: alert-dialog, badge, button, switch, base-data-table, base-info-hint, base-states, base-status-badge, ui-ap-approval-policies-list.
Usage
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
| Prop | Type | Description |
|---|---|---|
policies | readonly ApprovalPolicy[] | The policies to show, in evaluation order. Passing them (or `loading` / `error`) fetches nothing. |
loading | boolean | |
error | Error | |
onRetry | () => void | |
supplierNames | Readonly<Record<string, string>> | Supplier names by id, for "Applies to". |
peopleNames | Readonly<Record<string, string>> | Approver names by user id. |
onToggleActive | (policy: ApprovalPolicy, active: boolean) => void | Makes the Active switch work. Wired for you (with the role check) when the list fetches. |
onDelete | (policy: ApprovalPolicy) => void | Shows Delete, behind a confirmation. Wired for you (with the role check) when the list fetches. |
pendingId | string | The policy a change is running for. |
onEdit | (policy: ApprovalPolicy) => void | Opens the policy form for a row; without it there is no Edit action. |
onCreate | () => void | Shows "New policy" in the empty state. |
columns | ApprovalPolicyColumnsProp | |
columnOrder | readonly string[] | |
columnVisibility | Readonly<Record<string, boolean>> | |
rowActions | ApprovalPolicyRowActionsProp | Pass `[]` for none. |
emptyState | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Replaces the empty state. |
hideFallThrough | boolean | Hides the note under the table on what happens when no policy matches. |
className | string |
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.
useApprovalPoliciesuseApprovalPolicyFormatuseApprovalPolicyMutationsuseApprovalPolicySupplierNamesuseBillReviewersuseMessagesusePermissionsFiles
Written to your app by the install command:
components/dolfin/ap/approval-policies-list.tsx372 lines