Skip to main content

Standalone Widgets by Framework

TradeScript product surfaces are framework-neutral. Angular, Vue, Nuxt, Svelte, React, Next.js, and plain JavaScript applications all use the same named sdk.<surface>.mount(...) modules. A mount returns the owner of that DOM surface, with update(...) for later prop changes and destroy() for route or component teardown.

The examples below mount a time-and-sales tape. Use the same framework lifecycle with sdk.marketDepth, sdk.watchlist, sdk.orderTicket, sdk.optionChain, sdk.accountPanel, or any other named surface.

TradeScript workspace composing a watchlist, chart, account summary, and order ticket as separate product surfaces
The same framework-neutral lifecycle mounts each standalone surface or composes them into a complete workspace.

Before mounting a widget

Your application provides four things:

  1. An authorized TradeScriptSdk created once from your deployment lease.
  2. A framework-owned HTML element with a real width and height.
  3. The typed controllers, adapters, and data required by that surface.
  4. The global SDK styles imported once by the application.
import { createTradeScriptSdk } from '@tradescript/pro/sdk/core';
import '@tradescript/pro/style.css';
import '@tradescript/pro/tailwind.css';

const sdk = await createTradeScriptSdk({ lease: deploymentLease });

The tape example receives marketData and symbol from an already-ready chart:

const chartMount = sdk.chart.mount({
mount: '#chart',
symbol: 'AAPL',
interval: '15m',
datafeed,
});

const chart = await chartMount.ready();
const marketData = chart.data();
const symbol = chart.chart().getSymbol();

Use your framework lifecycle

Mount after the route has created its DOM, update from application state, and destroy from the router's disposal callback:

const tape = sdk.timeAndSales.mount({
mount: document.querySelector('#tape')!,
marketData,
symbol,
maxRows: 100,
theme: 'dark',
});

export function setTapeDensity(compact: boolean) {
tape.update({ maxRows: compact ? 40 : 100 });
}

export function leaveRoute() {
tape.destroy();
}

Swap in another product surface

The framework lifecycle does not change when the widget changes. Only the module and typed props do:

NeedModule
Market depthsdk.marketDepth
Time and salessdk.timeAndSales
Watchlistsdk.watchlist
Session statussdk.sessionMeta
Account panel or summarysdk.accountPanel, sdk.accountSummary
Order ticketsdk.orderTicket, sdk.orderTicketLauncher
Option chain or option ticketsdk.optionChain, sdk.optionOrderTicket
Price laddersdk.ladder
Complete terminalsdk.tradingTerminal
Composable layoutsdk.layout
Agent activitysdk.agentConsole

Open the Widget API for exact prop types and the Product Surfaces page to choose the smallest surface for the user workflow.

Verify the integration

  1. Mount the route and confirm the widget reaches its ready state with the expected data, broker, or storage controller.
  2. Change one host prop and confirm update(...) changes the existing surface without duplicating DOM or subscriptions.
  3. Leave the route and confirm destroy() stops subscriptions and removes the widget DOM.
  4. Return to the route and confirm a new instance mounts cleanly.

Next steps