Credit notes list page
The credit notes list: Receivables header, a customer filter (once there are customers to tell apart) and the credit notes table with pagination. Plain node props for header actions, the empty state and an aside; takes the table's columns, rowActions and initial filters.
Page: A complete screen for one route, such as a bill or the invoices list. Mount it on a route in your app; connected SDK pages provide data and actions; standalone UI pages receive them as props. Pages vs components
Works with Dolfin’s SDK context, 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-notes-list-pageAlso installs: ar-credit-notes-table, base-page, ui-ar-credit-notes-list-page.
Usage
import { CreditNotesListPage } from "@/components/dolfin/ar/credit-notes-list-page";
// A whole screen: mount it on a route, inside your <DolfinProvider>.
export default function Route() {
return <CreditNotesListPage />;
}Renders inside DolfinProvider (set it up once). It renders the data you pass as props.
API reference
| Prop | Type | Description |
|---|---|---|
headerActions | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Buttons in the page header (credit notes are raised from an invoice, so there is no New button here). |
aside | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | A column beside the table. |
className | string | |
columns | CreditNoteColumnsProp | |
columnOrder | readonly string[] | |
columnVisibility | Readonly<Record<string, boolean>> | |
rowActions | CreditNoteRowActionsProp | Pass `[]` for none. |
variant | DataTableVariant | |
loading | boolean | |
filters | CreditNoteListFilters | Initial filters for the list it loads: a customer, an invoice. A changed value re-applies. |
error | Error | |
page | number | 1-based page number, for your own rows. |
creditNotes | readonly { 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). |
onRetry | () => void | |
emptyState | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Replaces the default empty state. |
pageSize | number | |
toolbarActions | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Extra controls beside the customer filter. |
hasNextPage | boolean | |
onPageChange | (page: number) => void | Shows the pager for your own rows. |
onRowClick | (note: CreditNote) => void | Called when a row is clicked; given, it replaces the row's link. |
getRowRoute | (note: CreditNote) => DolfinRoute | null | Where a row links to; the credit note by default (return its invoice when you have no credit note page). |
classNames | DataTableClassNames | |
pager | boolean | Show 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. |
emptyAction | string | 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). |
onIssue | (note: CreditNote) => void | Adds Issue to drafts' row menus (with your own rows). |
forCustomer | boolean | The empty state reads "for this customer". |
onCustomerFilterChange | (customerId: string | null) => void | |
hideCustomerFilter | boolean | Hide the customer filter (a list already scoped to one customer or invoice). |
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 page uses. Use them directly from @dolfinai/react to build your own version.
useMessagesFiles
Written to your app by the install command:
components/dolfin/ar/credit-notes-list-page.tsx44 lines