Expense approval policies list page
The expense approval policies page: Expenses header with New policy, the policies list, the policy documents panel and the policy dialog for creating and editing. ReactNode props for header actions, the empty state, an aside and the documents panel; takes the list's columns and rowActions.
Page: A complete screen for one route, such as a bill or the invoices list. Mount it on a route in your app; connected SDK pages provide data and actions; standalone UI pages receive them as props. 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-approval-policies-list-pageAlso installs: button, base-page, expenses-approval-policies-list, expenses-approval-policy-form-dialog, expenses-policy-documents-panel, ui-expenses-approval-policies-list-page.
Usage
import { ExpenseApprovalPoliciesListPage } from "@/components/dolfin/expenses/expense-approval-policies-list-page";
// A whole screen: mount it on a route, inside your <DolfinProvider>.
export default function Route() {
return <ExpenseApprovalPoliciesListPage />;
}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 |
|---|---|---|
headerActions | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Buttons beside "New policy". |
emptyState | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Replaces the list's empty state. |
aside | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | A column beside the list, e.g. a note on how policies are checked. |
documents | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Replaces the policy documents panel under the list; `null` hides it. |
onSaved | (policy: ExpensePolicy) => void | Called after a policy is created or saved. |
className | string | |
columns | ExpensePolicyColumnsProp | |
columnOrder | readonly string[] | |
columnVisibility | Readonly<Record<string, boolean>> | |
rowActions | ExpensePolicyRowActionsProp | Pass `[]` for none. |
hideFallThrough | boolean | Hides the note under the table on what happens when no policy matches. |
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 page uses. Use them directly from @dolfinai/react to build your own version.
useExpensePoliciesuseMessagesusePermissionsFiles
Written to your app by the install command:
components/dolfin/expenses/expense-approval-policies-list-page.tsx116 lines