Watchlist
A React component in Beamline's Trading category.
A selectable, sortable list of markets with mini trends, prices, changes and stars.
Use it for
- The market switcher in a terminal sidebar.
Not for
- Hundreds of instruments with filters → data-grid.
Anatomy
- header (sort buttons aligned over their columns; sorted one in ink with an arrow icon)
- row (star, symbol and name, mini trend, price, 24h change chip; 24h volume and the day's range in a wide room)
- star (24px target, filled when on; an unstarred star waits for attention)
- 24h change chip (tint + ▲/▼ + signed %)
- day range (a track from the 24h low to the high with a mark at the price; hatched when unmeasured; read as words)
- empty text
Variants
- trend: on, off
States
- rest
- row hover (tint, 0ms in / --pui-motion-out out)
- row focus (inset ring)
- selected (accent tint + 2px accent-ink edge at the inline start, text in ink)
- sorted ascending / descending
- starred (filled orange star, floats to the top)
- unstarred star: shown on row hover, focus inside or selection, always on touch; its place is kept, so nothing moves when it shows
- missing price or change (—)
- empty
- narrow (container ≤300px, e.g. a terminal's 272–304px rail): the mini trend gives way to symbol and figures
- narrowest (container ≤248px, a phone popover or collapsed rail): the 24h chip moves under the price; symbols stay whole down to 200px
- wide (container ≥26rem): a 24h volume column joins, sortable; ≥34rem: the day's range
Keyboard
- listbox: ↑/↓, Home/End, Enter/Space selects
- Headers are buttons that cycle ascending → descending → off; their names say the current direction
- S stars or unstars the focused market when stars are shown (the star button itself stays out of the tab order)
- The roving tab stop follows the market symbol when starring or sorting changes its row index; ArrowDown continues from that symbol in the new order.
Motion
A sort or a star re-flows the rows to their new places once; the order is then kept while prices tick, so live data never moves a row from under the pointer (sort again to take a new order). The selected market's tint and rule are one plate that travels to the next market chosen. Hover arrives at 0ms and leaves over --pui-motion-out; a star's press is acknowledged at once. Live prices update in place.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
items (required) | Ticker[] | — | Items rendered in the component. Required. |
value / defaultValue / onValueChange | string | — | value: Controlled selected market symbol; null clears the selection; omit to use defaultValue. defaultValue: Initial selected market symbol when uncontrolled. Defaults to null. onValueChange: Reports selected market symbol after an edit; no callback by default. |
starred / onStarredChange | string[] | — | starred: Controlled starred symbols; omit both this and defaultStarred to hide stars. onStarredChange: Reports starred symbols after a change; no callback by default. |
style / ref | CSSProperties / 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. |
classNames | WatchlistClassNames | — | 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. |
value | string | null | — | Controlled selected market symbol; null clears the selection; omit to use defaultValue. |
defaultValue | string | null | — | Initial selected market symbol when uncontrolled. Defaults to null. |
onValueChange | ((symbol: string) => void) | — | Reports selected market symbol after an edit; no callback by default. |
starred | string[] | — | Controlled starred symbols; omit both this and defaultStarred to hide stars. |
onStarredChange | ((symbols: string[]) => void) | — | Reports starred symbols after a change; no callback by default. |
decimals | ((t: Ticker) => number) | — | Returns price precision for each market; defaults to precision derived from its last price. |
trend | boolean | — | Shows a miniature price history beside each market. Defaults to true. |
className | string | — | Classes on the documented visual root; no override by default. |
ref | Ref<HTMLDivElement> | — | Receives the documented root element; no ref by default. |
defaultStarred | string[] | — | Initial starred symbols when uncontrolled; omitted by default to hide stars. |
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
Used in
Dependencies
lucide-react
Import
import { Watchlist } from "@beamline/watchlist";
Get it
Watchlist 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.
- 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…
- Positions table: Open positions with live unrealised PnL, liquidation warnings and close actions.
- 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.