Xzero UI
Pro library

Market terminalPro

A trading terminal with a canvas candlestick chart, volume, moving averages, crosshair OHLC readout, wheel, drag and pinch zoom, a live watchlist with sparklines and flashing prices, and a market and limit order ticket.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/market-terminal
Live · keyboard ready

Render <MarketTerminal /> for the demo, or pass symbols, holdings, buyingPower, orders, defaultTicker and defaultRange with your own data. Pass onPlaceOrder and onCancelOrder (they can return promises) to connect it to a real order API.

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui-pro/market-terminal

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { MarketTerminal } from "@/components/xzero/blocks/market-terminal/market-terminal";

export function Trade() {
  return (
    <MarketTerminal
      defaultTicker="AAPL"
      defaultRange="1D"
      onPlaceOrder={order => api.orders.create(order)}
      onCancelOrder={order => api.orders.cancel(order.id)}
    />
  );
}

API reference

MarketTerminal

A trading terminal screen. A candlestick chart with volume, two moving averages, a crosshair with an OHLC readout, and wheel, drag and pinch zoom sits beside a watchlist with intraday sparklines and flashing live prices, and an order ticket for market and limit orders with an order list.

PropTypeDefaultDescription
symbolsMarketSymbol[]SYMBOLSWatchlist symbols in order: ticker, name, exchange, price, previous close, daily volatility (a fraction such as .02) and average daily volume. Candles are generated from these, deterministically per ticker and range.
holdingsHolding[]HOLDINGSShares held per ticker. The ticket shows the position and blocks selling more than is held.
buyingPowernumber24860.35Cash available for buys. The ticket blocks a buy that costs more, and fills update it.
ordersOrderRecord[]ORDERSOrders in the ticket's list, newest first: side, type, ticker, shares, price, status (filled, working or canceled) and time.
defaultTickerstring–Ticker charted on first render. Defaults to the first symbol.
defaultRange"1D" | "5D" | "1M" | "6M" | "1Y""6M"Time range on first render. 1D and 5D use 5 and 30 minute candles; the rest are daily.
defaultAveragesAverageId[]["ma20", "ma50"]Moving averages drawn on first render. Viewers toggle them in the toolbar.
livebooleantrueStreams simulated ticks. Viewers can still pause and resume them with the Live button.
tickIntervalnumber1200Milliseconds between simulated ticks.
onPlaceOrder(order: OrderRequest) => void | Promise<void>–Called when an order is submitted with its side, type, ticker, shares and price. Return a promise to keep the button pending; a rejection leaves the order unplaced and says so under the button.
onCancelOrder(order: OrderRecord) => void | Promise<void>–Called when a working order is canceled from the list.
classNamestring–Class on the root element.

Keyboard interactions

KeysAction
TabMoves through the Live button, the range control, the average toggles, the zoom buttons, the chart, the watchlist rows and the order ticket.
Arrow left / Arrow rightOn the chart, moves the crosshair one candle and reads it out. The view follows the crosshair past either edge.
Shift + Arrow left / rightOn the chart, moves the crosshair ten candles.
Home / EndOn the chart, jumps to the first or the live candle.
+ / -On the chart, zooms in or out around the crosshair.
0On the chart, resets the view to the range's default window.
EscapeOn the chart, clears the crosshair.
Arrow up / Arrow down, Home / EndIn the watchlist, moves between symbols. Enter or Space charts the focused symbol.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Guidance for AI tools

Blocks are complete, self-contained screens with sample data. Replace the sample data and connect the callbacks described above. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components