Skip to content

Framework bindings

Lumen Ticks keeps framework adapters intentionally thin: each adapter creates the chart on mount, forwards option changes to applyOptions, and calls destroy() on unmount.

Data always goes through the ChartApi, never through reactive framework props. Passing millions of bars through component props would force unnecessary diffing and allocations on every tick.

Selecting a tab below also selects that framework across Getting started and every feature guide.

Pass display configuration (such as theme, grid, crosshair, priceScales, or localization) through the wrapper’s options prop and load data through the ChartApi instance:

pnpm add @lumen-ticks/core
import { createChart } from '@lumen-ticks/core';
const chart = createChart(document.getElementById('chart')!, { theme: 'dark' });
const candles = chart.addSeries('candlestick', { id: 'BTCUSD' });
candles.setData(bars);
chart.timeScale().fitContent();
// Clean up when leaving the page or view:
chart.destroy();

Keep the series handle outside component state and forward incoming ticks straight to candles.update(tick). Your UI framework never re-renders on price ticks, while the data engine updates the bar and every indicator incrementally in one atomic patch:

import { createChart, type OhlcBar, type OhlcColumns } from '@lumen-ticks/core';
const chart = createChart(document.getElementById('chart')!, { theme: 'auto' });
const candles = chart.addSeries('candlestick', { id: 'BTCUSD' });
candles.setData(history);
candles.addIndicator('ema', { params: { period: 20 } });
chart.timeScale().fitContent();
const stopStream = subscribeTicks('BTCUSD', (tick: OhlcBar) => {
candles.update(tick);
});
// Later on teardown:
stopStream();
chart.destroy();

Chart events such as crosshairMove, click, error, and timeScale().subscribe('visibleTimeRangeChange', ...) return an unsubscribe function. Wire them into reactive state to render custom legends, toolbars, or alerts:

import { createChart } from '@lumen-ticks/core';
const chart = createChart(document.getElementById('chart')!);
const legend = document.getElementById('legend')!;
const unsubscribe = chart.subscribe('crosshairMove', event => {
const bar = event.values.get('BTCUSD');
legend.textContent =
bar && 'close' in bar ? `O ${bar.open.toFixed(2)} H ${bar.high.toFixed(2)} C ${bar.close.toFixed(2)}` : '';
});
// Call unsubscribe() when no longer needed (or chart.destroy() removes all listeners).
Package Export Props / params Chart access Lifecycle
@lumen-ticks/core createChart (container, options?) Returned ChartApi Manual destroy()
@lumen-ticks/core createChart (container, options?) Returned ChartApi Manual destroy()
@lumen-ticks/react LumenChart options?, className?, style? ref (ChartApi | null) useEffect mount / unmount (StrictMode)
@lumen-ticks/vue LumenChart options? (plus fallthrough attrs) Template ref { chart: ChartApi | null } onMounted / onBeforeUnmount
@lumen-ticks/svelte lumenChart { options?, onReady? } onReady(chart) callback Svelte action update / destroy
@lumen-ticks/solid LumenChart options?, class?, onReady? onReady(chart) callback onMount / onCleanup (client-side only)

Every framework package also re-exports ChartApi, ChartOptions, DeepPartial, the worker configuration helpers (configureWorker, createWorkerPool, getWorkerConfig, setMaxWorkers, getMaxWorkers), and a standalone ./worker subpath entry. Lower-level types such as PanePrimitive or OhlcColumns can be imported from @lumen-ticks/core (or lumen-ticks).

  • Server-side rendering (SSR): Canvases and ResizeObserver run in the browser. Mark React components with 'use client' in Next.js App Router, wrap Vue charts in <ClientOnly> in Nuxt, mount Svelte actions on the client in SvelteKit (Svelte actions only execute in the browser), and wrap @lumen-ticks/solid with clientOnly() in SolidStart because it calls document.createElement('div') during component setup.
  • Sizing: Give the chart element an explicit CSS height (style={{ height: 420 }}, style="height: 420px", or a CSS class with height for Solid). autoSize is enabled by default and shares one ResizeObserver across all charts on the page.