Create accounting account dialog
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
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-category-account-dialogAlso installs: button, dialog, input, label, select, base-theme, ui-expenses-category-account-dialog.
Usage
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
| Prop | Type | Description |
|---|---|---|
open required | boolean | |
onOpenChange required | (open: boolean) => void | |
purpose | CategoryAccountPurpose | |
platformName | string | The connected platform's name, e.g. "QuickBooks". Looked up when not given. |
companyName | string | The company in that platform. Looked up with the platform when not given. |
ruleCoversCategory | boolean | A category rule covers this expense, so the new account codes this expense only; the description says so. |
onCreated | (account: MccLedgerAccount) => void | Called with the new account after the dialog created it (the dialog has closed). |
onSubmit | (values: CategoryAccountValues) => void | Create the account yourself: the dialog sends nothing and looks nothing up then (pass `platformName`). Close it with `onOpenChange(false)` once saved. |
submitting | boolean | |
error | Error | Why the last save failed: shown in words under the fields. |
codeRequired | boolean | The platform needs an account code: the code field is marked as required. |
className | string |
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.
useMccAccountingPlatformuseMccCreateAccountuseMessagesFiles
Written to your app by the install command:
components/dolfin/expenses/category-account-dialog.tsx202 lines