dolfindevelopers

Credit notes table

ComponentReceivablesSDK + UI

Credit notes raised against your invoices: number and reason, net, tax with its rate, amount (money off once issued), status and created date. A customer filter, cursor pagination, rows that open the credit note and an Issue row action on drafts. Takes columns, rowActions and initial filters (customer, invoice).

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

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-credit-notes-table

Also installs: button, select, ar-credit-note-parts, base-data-table, base-money, base-states, ui-ar-credit-notes-table.

Usage

screen.tsx
import { CreditNotesTable } from "@/components/dolfin/ar/credit-notes-table";

// Place it anywhere inside your <DolfinProvider>.
<CreditNotesTable />

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
filtersCreditNoteListFiltersInitial filters for the list it loads: a customer, an invoice. A changed value re-applies.
pageSizenumber
creditNotesreadonly { id?: string; organisationId?: string; invoiceId?: string; documentNumber?: null | string; amount?: number | string; netAmount?: n…Your own rows: the table then shows them and makes no request (and no customer filter).
loadingboolean
errorError
onRetry() => void
pagenumber1-based page number, for your own rows.
hasNextPageboolean
onPageChange(page: number) => voidShows the pager for your own rows.
onIssue(note: CreditNote) => voidAdds Issue to drafts' row menus (with your own rows).
forCustomerbooleanThe empty state reads "for this customer".
onCustomerFilterChange(customerId: string | null) => void
hideCustomerFilterbooleanHide the customer filter (a list already scoped to one customer or invoice).
toolbarActionsstring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Extra controls beside the customer filter.
columnsCreditNoteColumnsProp
columnOrderreadonly string[]
columnVisibilityReadonly<Record<string, boolean>>
rowActionsCreditNoteRowActionsPropPass `[]` for none.
getRowRoute(note: CreditNote) => DolfinRoute | nullWhere a row links to; the credit note by default (return its invoice when you have no credit note page).
onRowClick(note: CreditNote) => voidCalled when a row is clicked; given, it replaces the row's link.
emptyStatestring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Replaces the default empty state.
emptyActionstring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…In the default empty state (e.g. "Show all customers" while filtered).
classNamestring
variantDataTableVariant
classNamesDataTableClassNames
pagerbooleanShow the built-in previous / next pager when there is more than one page. Default true; pass false when you draw your own pager from the list's pagination (the table still dims while a page loads).
onRowHover(row: { id?: string; organisationId?: string; invoiceId?: string; documentNumber?: null | string; amount?: number | string; netAmount?: numb…Called with the row the pointer moves onto, and with `null` when the pointer leaves the rows (e.g. to highlight the row's point in a chart next to the table). Moving between rows reports the new row without a `null` first.

Customisation

Without editing the source, you can change:

Class names
classNameclassNames.frameclassNames.headerclassNames.headerCellclassNames.rowclassNames.cellclassNames.pager
Messages
ar.creditNotes

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.

useCreditNoteMutationsuseCreditNotesuseCustomerOptionsuseDolfinLocaleuseMessages

Files

Written to your app by the install command:

  • components/dolfin/ar/credit-notes-table.tsx 350 lines
  • components/dolfin/ar/credit-note-columns.tsx 93 lines