dolfindevelopers

Supplier credit tab

ComponentPayablesSDK + UI

A supplier's credit for a tab on the supplier page: the credit available per currency and a paged ledger of every movement (credit notes issued, applied to bills, reversed) that links to the note or the bill. Takes columns.

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/ap-supplier-credit-tab

Also installs: base-data-table, base-money, base-page, base-states, base-theme, ui-ap-supplier-credit-tab.

Usage

screen.tsx
import { SupplierCreditTab } from "@/components/dolfin/ap/supplier-credit-tab";

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

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
supplierIdstringFetches the supplier's balances and ledger. Leave it out and pass `balances` and `entries` to draw your own.
balancesreadonly { currency: string; available?: number | string; }[]Credit available, one per currency. Passing it, `entries`, `loading` or `error` fetches nothing.
entriesreadonly { entryType?: components["schemas"]["SupplierCreditLedgerEntryType"]; supplierCreditNoteId?: string; billId?: null | string; applic…The ledger page shown, newest first.
loadingboolean
errorError
onRetry() => void
pagenumber1-based page shown; the pager shows with `onPageChange`.
hasNextPageboolean
onPageChange(page: number) => void
columnsreadonly Column[] | ((defaults: Column[]) => readonly Column[])Replace the columns, or adjust the defaults (date, movement, reference, amount).
pageSizenumber
emptyStatestring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Replaces the ledger's empty state.
classNamestring

Customisation

Without editing the source, you can change:

Class names
className
Messages
ap.supplierCreditNotes.tab

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.

useDolfinLocaleuseMessagesuseSupplierCredit

Files

Written to your app by the install command:

  • components/dolfin/ap/supplier-credit-tab.tsx 226 lines