dolfindevelopers

Create credit note dialog

DialogReceivablesSDK + UI

Raises a draft credit note against an invoice: the whole invoice or one line (which inherits its tax rate and pre-fills what was billed), the tax rate for a whole-invoice credit (required when the lines differ), the gross amount against the outstanding balance, and a reason. Mount it from an invoice page.

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/ar-create-credit-note-dialog

Also installs: button, dialog, input, label, select, textarea, base-money, ui-ar-create-credit-note-dialog.

Usage

screen.tsx
import { CreateCreditNoteDialog } from "@/components/dolfin/ar/create-credit-note-dialog";

// Place it anywhere inside your <DolfinProvider>.
<CreateCreditNoteDialog invoice={invoice} 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
invoice required{ id?: string; organisationId?: string; customerId?: string; documentNumber?: null | string; currency: string; issueDate?: string; dueDate?:…The Issued or PartiallyPaid invoice to credit: its lines, tax rates, currency and outstanding balance.
open requiredboolean
onOpenChange required(open: boolean) => void
onCreated(note: CreditNote) => voidCalled with the new draft after the dialog closes.
onSubmit(draft: CreditNoteDraft) => Promise<CreditNote | void> | voidRaises the credit note yourself instead of the SDK; the dialog closes once it resolves.
submittingbooleanYour own save is running.
taxRatesreadonly { id?: string; organisationId?: null | string; code: string; name: string; rate?: number | string; source: string; isReadOnly?: boo…The tax rates a whole-invoice credit can take, instead of loading them.
classNamestring

Customisation

Without editing the source, you can change:

Class names
className
Messages
ar.creditNotes.createDialogcore.errors

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.

useCreditNoteMutationsuseCreditNoteTaxRatesuseMessages

Files

Written to your app by the install command:

  • components/dolfin/ar/create-credit-note-dialog.tsx 233 lines