dolfindevelopers

Payables stat tiles

ComponentPayablesSDK + UI

To pay, Overdue and Paid in the last 30 days, each with an explanation, multi-currency detail and trend, plus loading, empty and error states. ApStatCard builds custom tiles from the same figures.

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-stats-cards

Also installs: button, skeleton, base-theme, base-money, base-stat-card, base-states, ui-ap-stats-cards, base-info-hint.

Usage

screen.tsx
import { ApStatsCards } from "@/components/dolfin/ap/stats-cards";

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

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
statsPartial<ApStatsFigures>The figures to show (`toPay`, `overdue`, `paid`, `isEmpty`, ...). Passing them (or `loading` / `error`) fetches nothing; leave all three out and the tiles read the payables overview themselves.
loadingboolean
errorErrorWith figures shown, a quiet "some figures failed" line; with none, the error state.
onRetry() => void
tilesreadonly ApStatTileKey[]Which built-in tiles to show, in order. Defaults to To pay, Overdue, Paid.
extraTiles(stats: Partial<ApStatsFigures>) => ReactNodeCustom tiles after the built-in ones; build them with `ApStatCard` from the same figures.
onAskAgent(prompt: string, tile: ApStatTileKey) => voidShows an Ask agent button on each tile; the prompt is the tile's question for an assistant.
emptyStatestring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…Replaces the empty state (no bills at all). Pass `false` to show the tiles at zero instead.
onSelectTile(tile: ApStatTileKey) => voidMakes the built-in tiles toggles, e.g. to filter the bills list by the tile picked.
selectedTileApStatTileKeyThe tile shown as picked (`aria-pressed`).
tileClassNamesStatCardClassNamesPer-part classes for every built-in tile (label, value, sub, ...).
classNamestring

Customisation

Without editing the source, you can change:

Class names
className
Messages
ap.homebase.statescore.errors

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.

useApStatsuseMessages

Files

Written to your app by the install command:

  • components/dolfin/ap/stats-cards.tsx 283 lines