Framework wrappers
Idiomatic wrappers for React, Vue, and Svelte. All three expose the same prop surface and forward a ref to the underlying Chart instance.
React
import { TradeCanvas, type TradeCanvasHandle } from '@tradecanvas/react'
import { BinanceAdapter } from '@tradecanvas/chart'
import { useRef } from 'react'
function App() {
const chartRef = useRef<TradeCanvasHandle>(null)
return (
<TradeCanvas
ref={chartRef}
symbol="BTCUSDT"
timeframe="5m"
theme="dark"
adapter={new BinanceAdapter()}
onReady={(chart) => {
chart.on('orderPlace', e => console.log(e.payload))
}}
/>
)
} Vue
<script setup lang="ts">
import { TradeCanvas } from '@tradecanvas/vue'
import { BinanceAdapter } from '@tradecanvas/chart'
const adapter = new BinanceAdapter()
</script>
<template>
<TradeCanvas
symbol="BTCUSDT"
timeframe="5m"
theme="dark"
:adapter="adapter"
@ready="(chart) => console.log('ready', chart)"
/>
</template> Svelte
<script lang="ts">
import { TradeCanvas } from '@tradecanvas/svelte'
import { BinanceAdapter } from '@tradecanvas/chart'
const adapter = new BinanceAdapter()
</script>
<TradeCanvas
symbol="BTCUSDT"
timeframe="5m"
theme="dark"
{adapter}
onReady={(chart) => console.log('ready', chart)}
/> Shared props
| Prop | Type | Notes |
|---|---|---|
symbol | string | Required. |
timeframe | TimeFrame | '1m' | '5m' | '15m' | '1h' | '4h' | '1d' |
theme | ThemeName | 'dark' | 'light' | 'darkTerminal' |
adapter | DataAdapter | Live stream source. |
historyLimit | number | Initial bars to load. |
trading | boolean | Enable trading overlay. |
onReady | (chart) => void | Fires after the chart mounts. |
The wrapper packages are currently demo/docs-only and not published to npm. Their source lives inpackages/react,packages/vue, andpackages/svelte— copy them into your project for now.