Create credit note dialog
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
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/ar-create-credit-note-dialogAlso installs: button, dialog, input, label, select, textarea, base-money, ui-ar-create-credit-note-dialog.
Usage
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
| Prop | Type | Description |
|---|---|---|
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 required | boolean | |
onOpenChange required | (open: boolean) => void | |
onCreated | (note: CreditNote) => void | Called with the new draft after the dialog closes. |
onSubmit | (draft: CreditNoteDraft) => Promise<CreditNote | void> | void | Raises the credit note yourself instead of the SDK; the dialog closes once it resolves. |
submitting | boolean | Your own save is running. |
taxRates | readonly { 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. |
className | string |
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.
useCreditNoteMutationsuseCreditNoteTaxRatesuseMessagesFiles
Written to your app by the install command:
components/dolfin/ar/create-credit-note-dialog.tsx233 lines