@get-asset/sdk

Cashflow Summary Card

Headless compound that fetches the cash-flow report for the range on screen, broken down by month, and exposes per-month money in and money out. It sums each month's gross inflows (positive movements) and outflows (negative movements) across the report's flow sections — excluding the starting / ending balances and the net-change line. Each value is also available as a 0–1 ratio against a shared scale, so a diverging bar chart can render inflows upward and outflows downward from a common $0 axis. It also exposes the range's net cashflow, money in and money outtotals for the header. The series covers every calendar month the range overlaps — a whole year gives the familiar twelve — and follows the AssetProvider's shared range (driven by the DatePicker) unless dateFrom / dateTo pin it.

Anatomy

Import the primitive and compose the parts you need.

<CashflowSummaryCard.Root dateFrom="2026-01-01" dateTo="2026-12-31">
<CashflowSummaryCard.Net />
<CashflowSummaryCard.TotalIn />
<CashflowSummaryCard.TotalOut />
<CashflowSummaryCard.Success>
<CashflowSummaryCard.Months>
<CashflowSummaryCard.Month />
<CashflowSummaryCard.MoneyIn />
<CashflowSummaryCard.MoneyInBar />
<CashflowSummaryCard.MoneyOut />
<CashflowSummaryCard.MoneyOutBar />
</CashflowSummaryCard.Months>
</CashflowSummaryCard.Success>
<CashflowSummaryCard.Loading></CashflowSummaryCard.Loading>
<CashflowSummaryCard.Empty>No data yet.</CashflowSummaryCard.Empty>
</CashflowSummaryCard.Root>

Required scopes

The access token used by AssetProvider must include this scope for this primitive to fetch data successfully:

  • report:read

API reference

Root props

PropTypeDefaultDescription
dateFromCalendarDateStringInclusive start (YYYY-MM-DD) of a fixed reporting range. Detaches the card from the AssetProvider's shared range entirely; must be paired with dateTo (passing one side alone throws). Use periodDateRange to derive the pair from a month, quarter or year. Omit both to follow the provider's DatePicker-driven range.
dateToCalendarDateStringInclusive end (YYYY-MM-DD) of the fixed reporting range. Must be paired with dateFrom.
monthsCashflowSummaryMonthOverride[]Override fetched data — one entry per month on screen. Each entry: { month, moneyIn, moneyOut } (moneyOut positive). Skips the API call.
scalenumberOverride the +/- bound for the bar chart. Defaults to a 'nice' value derived from the largest in/out figure.
state"loading" | "error" | "empty"Force a specific state for testing.
lockedbooleanGate the report for an unentitled viewer. Activates the Locked state and skips the API fetch. See /docs/sdk/locked-upsell.
upsell{ title?, description?, ctaLabel?, onUpgrade? }Locked-state copy + upgrade handler; merged field-by-field over the card's default copy, then the generic fallback.
childrenrequiredReactNodeCompound parts.

Parts

Container

Always rendered. Provides data and context to its children.

PartDescription
CashflowSummaryCard.RootFetches the cash-flow report and provides per-month money in / out, the range's totals, and a shared scale.
CashflowSummaryCard.Period
asChild?, format?
Renders the resolved period — "2026" for a whole year, "Q3 2026" for a quarter, "Aug 2026" for a month, and the range label ("7 – 14 Jan 26") for anything else.

Header totals

Range-level figures for the card header.

PartDescription
CashflowSummaryCard.Net
asChild?, format?
Net cashflow across the range (money in − money out).
CashflowSummaryCard.TotalIn
asChild?, format?
Sum of every month's money in.
CashflowSummaryCard.TotalOut
asChild?, format?
Sum of every month's money out (positive magnitude — format it as an outflow).

Success

Renders when the range has cashflow data.

PartDescription
CashflowSummaryCard.SuccessState wrapper. Compose the chart inside.
CashflowSummaryCard.MonthsIterates the months of the range, setting a per-month context.
CashflowSummaryCard.Month
asChild?
Renders the month number (1-12) for the current month.
CashflowSummaryCard.MoneyIn / MoneyOut
asChild?
Renders the raw cash-in / cash-out amount for the current month.
CashflowSummaryCard.MoneyInBar / MoneyOutBar
asChild?
A bar element whose height is the value's ratio of the scale (data-ratio attribute). MoneyIn renders upward, MoneyOut downward.

Loading

PartDescription
CashflowSummaryCard.LoadingState wrapper. Render a skeleton / spinner inside.

Empty

PartDescription
CashflowSummaryCard.EmptyState wrapper. Renders when the range has no cashflow movements.

Error

PartDescription
CashflowSummaryCard.ErrorState wrapper.
CashflowSummaryCard.ErrorMessage
asChild?
Renders the error message string.
CashflowSummaryCard.Retry
asChild?
Button that re-runs the fetch.

Locked

Renders when `locked` is set — the viewer isn't entitled to the report. Mutually exclusive with the other states, and no data is fetched. See the Locked / upsell guide for composing the teaser + upgrade UI.

PartDescription
CashflowSummaryCard.LockedState wrapper. Compose the upgrade / upsell UI inside — see LockedUpsell.

Unlocked

Renders whenever the card is NOT locked — the inverse of Locked.

PartDescription
CashflowSummaryCard.UnlockedState wrapper. Useful for gating extras (like the insights panel) that should also disappear while locked.

Hooks

PartDescription
useCashflowSummaryCard()Hook returning range, period, months, scale, totalIn, totalOut, net, hasData, loading, error, locked, retry.
useCashflowSummaryMonth()Hook used inside a Months iteration; returns the current month's { month, moneyIn, moneyOut, inRatio, outRatio }.