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
- Leveraged positions with liquidation prices on a trading screen (positions-table in trading-terminal).
- Browsing markets you don't hold (market-screener).
- The record of orders and fills (order-history).
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
| Prop | Type | Default | Description |
|---|---|---|---|
holdings (required) | PortfolioHolding[] | — | Assets held by the account, with null for unavailable prices or costs. Required. |
cash | number | 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. |
dailyPnl | PnlDay[] | — | Profit or loss per day ("YYYY-MM-DD"; null: never recorded), shown a month at a time with week and month totals. |
realised | number | 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. |
benchmarkLabel | string | "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. |
currency | string | "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 / ref | string / 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. |
range | PortfolioRange | — | Controlled reporting range; omit to use defaultRange. |
defaultRange | PortfolioRange | — | 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". |
updatedAt | number | 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. |
title | string | — | Heading shown above the content. Defaults to "Portfolio". |
className | string | — | Classes on the documented visual root; no override by default. |
classNames | Partial<Record<"root" | "header" | "total" | "figures" | "daily" | "performance" | "all… | — | Classes for the named visual parts; no part overrides by default. |
style | CSSProperties | — | Inline styles on the documented visual root; no inline overrides by default. |
ref | Ref<HTMLElement> | — | Receives the documented root element; no ref by default. |
manual | boolean | — | Server owns ordering, filters, search and page slicing. Default false. |
sort | ListSort | — | |
defaultSort | ListSort | — | |
onSortChange | ((sort: ListSort) => void) | — | |
filters | ListFilters | — | |
defaultFilters | ListFilters | — | |
onFiltersChange | ((filters: ListFilters) => void) | — | |
query | string | — | |
defaultQuery | string | — | |
onQueryChange | ((query: string) => void) | — | |
selected | string[] | — | Stable row IDs, retained across server pages. |
defaultSelected | string[] | — | |
onSelectedChange | ((ids: string[]) => void) | — | |
selectable | boolean | — | |
loading | boolean | — | |
error | ReactNode | Error | — | Errors retain the last completed rows. Error objects are rendered by their message. |
onRetry | (() => void | Promise<unknown>) | — | |
emptyLabel | string | — | |
allowSelectAllMatching | boolean | — | |
onSelectAllMatching | ((scope: { rowCount: number; query: string; filters: ListFilters; }) => void) | — | |
pagination | boolean | — | Enable page controls explicitly. Page-related props also enable them, unless onEndReached is supplied. |
page | number | — | One-based requested page. Default 1. |
defaultPage | number | — | |
onPageChange | ((page: number) => void) | — | |
pageSize | number | — | Positive rows per page. Default 25. |
defaultPageSize | number | — | |
onPageSizeChange | ((pageSize: number) => void) | — | |
rowCount | number | null | — | Total matching rows on the server. null means unknown. Local grids calculate it before slicing. |
total | number | 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. |
hasMore | boolean | — | Whether another batch exists; defaults to true with onEndReached. False stops requests. |
loadingMore | boolean | — | An append request is pending; retain every loaded row. |
Built from
- slot-text
- metric-card
- segmented-control
- area-chart
- pie-chart
- pnl-calendar
- data-grid
- sparkline
- button
- badge
- empty-state
- skeleton
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…