dolfindevelopers

Expense report card

ComponentExpensesSDK + UI

The shell every expenses overview card is built from: a titled card with an InfoHint taking report, loading, error and onRetry, that loads and fails on its own, plus the bar, segmented bar, short-list and linked-row panel the report cards use. Build custom report cards from it and the report hooks.

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

Works with Dolfin’s SDK context, 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/expenses-report-card

Also installs: button, base-theme, base-page, base-info-hint, ui-expenses-report-card.

Usage

screen.tsx
import { ExpensesReportCard } from "@/components/dolfin/expenses/report-card";

// Place it anywhere inside your <DolfinProvider>.
<ExpensesReportCard title={title} errorMessage={errorMessage} />

Renders inside DolfinProvider (set it up once). It renders the data you pass as props.

API reference

PropTypeDescription
title requiredstring
errorMessage requiredstringShown when the report fails on the server or the network.
hintstring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…A sentence explaining the card, behind an InfoHint beside the title.
report{}The report you hold; while `loading` without one the card shows its loading line.
loadingboolean
errorErrorShows the card's error line (with Try again when `onRetry` is given).
onRetry() => void
stalebooleanA newer read is on its way: the figures dim.
childrenstring | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.Re…
classNamestring
data-testidstring

Customisation

Without editing the source, you can change:

Class names
className
Messages
base.infoHint.moreAboutbase.states.retrycore.errorsexpenses.home

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.

useMessages

Files

Written to your app by the install command:

  • components/dolfin/expenses/report-card.tsx 269 lines