Credit note detail
One credit note: header with the signed amount, customer and reason, status, Issue and Delete on drafts, the draft notice, amounts (net, tax at its rate, credit), details, the invoice it credits and its history. Props for header actions, a status badge (e.g. e-invoice delivery), extra detail rows and extra sections. Exports each card for your own layout.
Component: A piece you place inside your own screens: a table, a form, a card or a dialog. You decide the layout around it. 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-credit-note-detailAlso installs: button, card, popover, separator, table, ar-credit-note-parts, base-data-table, base-entity-cell, base-info-hint, base-money, base-page, base-states, base-timeline, ui-ar-credit-note-detail.
Usage
import { CreditNoteDetail } from "@/components/dolfin/ar/credit-note-detail";
// Place it anywhere inside your <DolfinProvider>.
<CreditNoteDetail />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 |
|---|---|---|
creditNoteId | string | Loads the note and the invoice it credits, and wires Issue and Delete. |
creditNote | { id?: string; organisationId?: string; invoiceId?: string; documentNumber?: null | string; amount?: number | string; netAmount?: number | s… | Your own credit note: the detail then makes no request. `null` reads as not found. |
invoice | { id?: string; organisationId?: string; customerId?: string; documentNumber?: null | string; currency: string; issueDate?: string; dueDate?:… | The invoice it credits (for the customer, the credited line and the invoice card). |
loading | boolean | |
error | Error | |
onRetry | () => void | |
onIssue | () => Promise<unknown> | void | Shows Issue on a draft. |
onDelete | () => Promise<unknown> | void | Shows Delete on a draft. |
draftActionsDisabledReason | string | |
headerActions | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Buttons after Issue and Delete. |
status | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Beside the status badge (e.g. e-invoice delivery status for an issued note). |
details | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Extra rows at the end of the details card, as `<dt>`/`<dd>` pairs. |
sections | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Extra cards after the invoice (e.g. the e-invoice delivery, or where it stands in your books). |
before | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Rendered above the header (e.g. a back link). |
onDeleted | () => void | After a draft is deleted. By id, goes back to the list by default. |
hideTimeline | boolean | |
hideInvoice | boolean | |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
ar.creditNotesbase.infoHint.moreAbout
Or edit the installed file directly: it is your code. See theming for colours and fonts.
Hooks
The SDK hooks this component uses. Use them directly from @dolfinai/react to build your own version.
useCreditNoteuseCreditNoteMutationsuseDolfinLocaleuseDolfinNavigateuseMessagesFiles
Written to your app by the install command:
components/dolfin/ar/credit-note-detail.tsx320 linescomponents/dolfin/ar/credit-note-cards.tsx197 lines