Positions table

A React component in Beamline's Trading category.

Open positions with live unrealised PnL, liquidation warnings and close actions.

Use it for

  • Under the chart in a terminal; portfolio pages.
  • A narrow panel (figures join the name line) or a wide one (every figure in its column).

Not for

Anatomy

  • header row (same height as body rows)
  • row (symbol with Long/Short word badge and leverage, size, entry, mark, liquidation with 'near' word, PnL with ▲/▼ and %, Close)
  • name line (narrow room: size · entry → mark · Liq., under the symbol)
  • pinned symbol column (clear at rest, opaque with a seam once scrolled)
  • footer (count · total PnL with ▲/▼)
  • empty text

Variants

  • density: compact, default

States

  • live PnL
  • current market (value: aria-current, accent tint and a rule at the inline start)
  • near liquidation (orange + word, in its column or in the name line)
  • row hover / focus inside (a far liquidation in the name line arrives with attention)
  • room: under 48rem size, entry → mark and liquidation join the name line and PnL stacks its %; under 26rem Close is its icon (its label stays for assistive tech); from 48rem every figure has its column
  • scrolled (pinned column opaque with a seam)
  • empty

Keyboard

  • Symbol and Close are buttons in reading order.

Motion

Closing a position closes the gap: the rows below slide up (--pui-duration-standard). PnL updates in place; row hover arrives at once. Removing a row moves focus to the next row's Close. A change of room changes structure at the step (columns join the name line or separate) without moving anything else; the far liquidation's reveal arrives at once and leaves over --pui-motion-out.

Props

PropTypeDefaultDescription
positions (required)Position[]—Open positions supplied by the trading account. Required.
onClose(p) => void—Adds a close button per row.
onSelect(symbol) => void—Called when an item is activated; no handler by default.
valuestring | null—The market on screen: its rows are marked (aria-current; a tint and a rule at the inline start).
priceDecimals(symbol) => number—Returns the price precision for a market symbol. Defaults to the component price precision.
density'compact'|'default'|'comfortable'—Row spacing; defaults to the scoped component or root density, then the stylesheet's default density.
style / refCSSProperties / native Ref—style: Inline styles on the documented visual root; no inline overrides by default. ref: Receives the documented root element; no ref by default.
classNamesPositionsTableClassNames—Classes for the named visual parts; no part overrides by default.
styleCSSProperties—Inline styles on the documented visual root; no inline overrides by default.
sizeDecimalsnumber—Maximum fractional digits used for trade sizes. Defaults to 4.
quotestring—Quote currency shown with prices or totals. Defaults to "USD".
emptyLabelstring—Message shown when no data is available. Defaults to "No open positions".
classNamestring—Classes on the documented visual root; no override by default.
refRef<HTMLDivElement>—Receives the documented root element; no ref by default.
getRowId((position: Position) => string)—Stable account position ID; defaults to symbol + side.
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>)—
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

Used in

Dependencies

lucide-react

Import

import { PositionsTable } from "@beamline/positions-table";

Get it

Positions table 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

  • Price chart: Candles, line or area price chart with volume, OHLC legend and reference lines, built for live ticks.
  • Market heatmap: Treemap of markets sized by weight and coloured by change, grouped by sector, with hatched no-data tiles.
  • Order book: Asks, spread and bids with cumulative depth bars, grouping, change flashes and keyboard price picking.
  • Options chain: Calls and puts for one expiry around a centre column of strikes: bid, ask, implied volatility, delta, volume and open interest, the money shaded in, a…
  • Depth chart: Cumulative bid and ask depth as stepped areas around the mid, with hover readout.
  • Ticker tape: A continuously scrolling row of symbols with price, change and mini trend; anyone can hold it: hover, keyboard focus or a tap.
  • Watchlist: A selectable, sortable list of markets with mini trends, prices, changes and stars.
  • Trades tape: Recent trades, newest first, with side glyphs, large-print marking and one-time arrival flashes.
  • Order ticket: Buy/sell order entry with limit, market and stop types, % of balance, inline validation and a live cost summary.
  • Swap form: Exchange one token for another: type what you pay (or Max), pick each token from a searchable list with balances, and the form quotes what you receive…
  • P&L calendar: A trader's month at a glance: every trading day's profit or loss in its cell, shaded deeper the bigger it was in the gain or loss colour and marked ▲ or…
  • Price ticker: Symbol, last price with a directional flash, 24h change and stats.
  • Funding countdown: Perpetual funding rate with who pays, and a live countdown ring to the next funding.

Guides: Build a trading terminal in React

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.