dolfindevelopers

Create accounting account dialog

DialogExpensesSDK + UI

Create an account in the organisation's own accounting platform without leaving: name, kind (expense, cost of sales, other expense) and code, which becomes required when the platform asks for one. Says which company's chart and platform it lands in, and what happens next for each purpose (code an expense, map a category, a card's default, or just the chart).

Dialog: a modal you open from your own screen. You control when it opens with its props. 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-category-account-dialog

Also installs: button, dialog, input, label, select, base-theme, ui-expenses-category-account-dialog.

Usage

screen.tsx
import { CategoryAccountDialog } from "@/components/dolfin/expenses/category-account-dialog";

// Place it anywhere inside your <DolfinProvider>.
<CategoryAccountDialog open={open} onOpenChange={handleOpenChange} />

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
open requiredboolean
onOpenChange required(open: boolean) => void
purposeCategoryAccountPurpose
platformNamestringThe connected platform's name, e.g. "QuickBooks". Looked up when not given.
companyNamestringThe company in that platform. Looked up with the platform when not given.
ruleCoversCategorybooleanA category rule covers this expense, so the new account codes this expense only; the description says so.
onCreated(account: MccLedgerAccount) => voidCalled with the new account after the dialog created it (the dialog has closed).
onSubmit(values: CategoryAccountValues) => voidCreate the account yourself: the dialog sends nothing and looks nothing up then (pass `platformName`). Close it with `onOpenChange(false)` once saved.
submittingboolean
errorErrorWhy the last save failed: shown in words under the fields.
codeRequiredbooleanThe platform needs an account code: the code field is marked as required.
classNamestring

Customisation

Without editing the source, you can change:

Class names
className
Messages
core.errorsexpenses.merchants.account.dialog

Or edit the installed file directly: it is your code. See theming for colours and fonts.

Hooks

The SDK hooks this dialog uses. Use them directly from @dolfinai/react to build your own version.

useMccAccountingPlatformuseMccCreateAccountuseMessages

Files

Written to your app by the install command:

  • components/dolfin/expenses/category-account-dialog.tsx 202 lines