Receivables stat tiles
Outstanding, Overdue and Received in the last 30 days, each with an explanation, multi-currency detail and trend, plus loading, empty and error states. ArStatCard 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
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-stats-cardsAlso installs: button, skeleton, base-theme, base-money, base-stat-card, base-states, ui-ar-stats-cards, base-info-hint.
Usage
import { ArStatsCards } from "@/components/dolfin/ar/stats-cards";
// Place it anywhere inside your <DolfinProvider>.
<ArStatsCards />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 |
|---|---|---|
stats | ArStatsFigures | Your own figures (from `deriveArStats`, or `useArStats`): the tiles then make no request. |
loading | boolean | |
error | Error | With no figures, the error state; with figures, a note that some failed to load. |
onRetry | () => void | |
tiles | readonly ArStatTileKey[] | Which built-in tiles to show, in order. Defaults to Outstanding, Overdue, Received. |
extraTiles | (stats: ArStatsFigures) => ReactNode | Custom tiles after the built-in ones; build them with `ArStatCard` from the same figures. |
onAskAgent | (prompt: string, tile: ArStatTileKey) => void | Shows an Ask agent button on each tile; the prompt is the tile's question for an assistant. |
emptyState | string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re… | Replaces the empty state (no invoices or payments at all). Pass `false` to show the tiles at zero instead. |
onSelectTile | (tile: ArStatTileKey) => void | Makes the built-in tiles toggles, e.g. to filter the invoices list by the tile picked. |
selectedTile | ArStatTileKey | The tile shown as picked (`aria-pressed`). |
tileClassNames | StatCardClassNames | Per-part classes for every built-in tile (label, value, sub, ...). |
className | string |
Customisation
Without editing the source, you can change:
- Class names
className- Messages
ar.homebase.states
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.
useArStatsuseMessagesFiles
Written to your app by the install command:
components/dolfin/ar/stats-cards.tsx311 lines