Portfolio overview

A React block (a whole screen) in Beamline's Trading app.

What an account holds and how it is doing: the total that rolls as prices tick with today's change, value over time against a benchmark, allocation by asset or sector, daily profit and loss, and every holding with its value, cost, unrealised P&L and weight.

Use it for

  • The home screen of an investing, trading or treasury app: total value, performance, allocation and holdings.
  • Any account that holds several assets bought at different prices.

Not for

Anatomy

  • header: title, the total value (rolling) with today's change in money and percent, feed state, and the primary Deposit
  • figures: unrealised P&L, realised P&L for the period, cash, and the best and worst holding today
  • performance: value over the chosen range (1W · 1M · 3M · 1Y · All) with the benchmark dashed; value or return
  • allocation: a donut by asset or by sector with each slice's share
  • daily P&L: the P&L calendar, a month at a time: each day's gain or loss shaded by size with ▲ ▼, week totals, the month's total, win days and best and worst day; a day never recorded is hatched
  • holdings: asset, amount, price, value, 24h change, cost, unrealised P&L in money and percent, weight, 7-day trend; a row opens the asset

Variants

  • 0: room: one column under 56rem (figures two across); performance beside allocation from 56rem; daily P&L under them

States

  • loading (every panel held in its shape)
  • live (values move in place as prices tick)
  • stale (prices old: says how old, values stay)
  • an asset without a price (its value and P&L —, totals say how many are left out)
  • cost unknown (P&L —)
  • no holdings (what goes here, Deposit)

Keyboard

  • Tab: Deposit, the range, the value/return switch, the charts (each readable by arrows), allocation's by-asset/by-sector, the holdings table
  • Table: arrows between cells, Enter opens the asset

Motion

The total and figures roll to each new value; a change of range draws the line again; allocation slices grow from their share when switching by asset/sector. Ticks change values in place, rows never slide. Idle: nothing runs.

Props

PropTypeDefaultDescription
holdings (required)PortfolioHolding[]—Assets held by the account, with null for unavailable prices or costs. Required.
cashnumber | null—Cash balance; null keeps account totals unmeasured until it is known. Defaults to null.
performance{ time: number; value: number | null; benchmark?: number | null }[]—Account value over the range, oldest first.
dailyPnlPnlDay[]—Profit or loss per day ("YYYY-MM-DD"; null: never recorded), shown a month at a time with week and month totals.
realisednumber | null—Realised P&L in the range.
range / defaultRange / onRangeChange"1W" | "1M" | "3M" | "1Y" | "ALL"—range: Controlled reporting range; omit to use defaultRange. defaultRange: Initial performance-history period when uncontrolled; defaults to 1M. onRangeChange: Reports date range after a change; no callback by default.
benchmarkLabelstring"Benchmark"Label for the comparison series. Defaults to "Benchmark".
status / updatedAt"loading" | "live" | "stale" / number | null—status: Current state of the record or operation. Defaults to "live". updatedAt: Timestamp in milliseconds of the latest accepted data update. Defaults to null.
currencystring"USD"ISO currency code used to format monetary values. Defaults to "USD".
onDeposit / onOpenAsset() => void / (symbol: string) => void—onDeposit: Opens the account deposit flow; no handler by default. onOpenAsset: Opens the supplied asset symbol; no handler by default.
className / classNames / style / refstring / PortfolioClassNames / CSSProperties / Ref<HTMLElement>—className: Classes on the documented visual root; no override by default. classNames: Classes for the named visual parts; no part overrides by default. style: Inline styles on the documented visual root; no inline overrides by default. ref: Receives the documented root element; no ref by default.
rangePortfolioRange—Controlled reporting range; omit to use defaultRange.
defaultRangePortfolioRange—Initial performance-history period when uncontrolled; defaults to 1M.
onRangeChange((range: PortfolioRange) => void)—Reports date range after a change; no callback by default.
status"live" | "loading" | "stale"—Current state of the record or operation. Defaults to "live".
updatedAtnumber | null—Timestamp in milliseconds of the latest accepted data update. Defaults to null.
onDeposit(() => void)—Opens the account deposit flow; no handler by default.
onOpenAsset((symbol: string) => void)—Opens the supplied asset symbol; no handler by default.
titlestring—Heading shown above the content. Defaults to "Portfolio".
classNamestring—Classes on the documented visual root; no override by default.
classNamesPartial<Record<"root" | "header" | "total" | "figures" | "daily" | "performance" | "all…—Classes for the named visual parts; no part overrides by default.
styleCSSProperties—Inline styles on the documented visual root; no inline overrides by default.
refRef<HTMLElement>—Receives the documented root element; no ref by default.
manualboolean—Server owns ordering, filters, search and page slicing. Default false.
sortListSort—
defaultSortListSort—
onSortChange((sort: ListSort) => void)—
filtersListFilters—
defaultFiltersListFilters—
onFiltersChange((filters: ListFilters) => void)—
querystring—
defaultQuerystring—
onQueryChange((query: string) => void)—
selectedstring[]—Stable row IDs, retained across server pages.
defaultSelectedstring[]—
onSelectedChange((ids: string[]) => void)—
selectableboolean—
loadingboolean—
errorReactNode | Error—Errors retain the last completed rows. Error objects are rendered by their message.
onRetry(() => void | Promise<unknown>)—
emptyLabelstring—
allowSelectAllMatchingboolean—
onSelectAllMatching((scope: { rowCount: number; query: string; filters: ListFilters; }) => void)—
paginationboolean—Enable page controls explicitly. Page-related props also enable them, unless onEndReached is supplied.
pagenumber—One-based requested page. Default 1.
defaultPagenumber—
onPageChange((page: number) => void)—
pageSizenumber—Positive rows per page. Default 25.
defaultPageSizenumber—
onPageSizeChange((pageSize: number) => void)—
rowCountnumber | null—Total matching rows on the server. null means unknown. Local grids calculate it before slicing.
totalnumber | null—Deprecated: Use rowCount. Canonical rowCount wins, including null.
onEndReached(() => void | Promise<unknown>)—Append mode: fetch another batch. The app appends it to the supplied rows.
hasMoreboolean—Whether another batch exists; defaults to true with onEndReached. False stops requests.
loadingMoreboolean—An append request is pending; retain every loaded row.

Built from

Dependencies

lucide-react, @tanstack/react-virtual

Import

import { Portfolio } from "@beamline/portfolio";

Get it

Portfolio overview is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Get Beamline · Connect your agent

More in Trading

  • Trading terminal: A perpetuals terminal on your feed and your account: ticker tape, market header with funding, candles, book / trades / depth, order ticket, account…
  • Market screener: The whole market at a glance and a way to narrow it down: a sector heatmap, today's top movers with the market's breadth, ready-made screens (gainers…

Part of Beamline UI: polished, editable React components and complete screens for custom applications. Build your own style from any look; tokens, fonts, radii, motion; not only colours.