TanStack
API Reference

Solid Chart

tsx
import { Chart } from '@tanstack/solid-charts'

The definition infers datum and coordinate types for every callback. Replace its identity when captured application values change. It also owns focus, tooltip, animation, keyboard policy, focus distance, and spatial indexing.

Props

PropTypeDefaultMeaning
definitionChartDefinitionRequiredFramework-neutral chart definition
ariaLabelstringRequiredAccessible chart name
ariaDescriptionstringNoneOptional accessible description
heightnumber320 without a ratioFixed CSS and scene height
aspectRationumberNonePositive width-to-height ratio when height is absent
widthnumberResponsiveFixed CSS and scene width
initialWidthnumber640Initial and server width before responsive measurement
tabIndexnumber0Surface tab index; keyboard: false forces -1
idPrefixstringGeneratedPrefix for renderer-owned document IDs
renderSvgChartSvgRenderer<TDatum, TXValue, TYValue>renderChartSvgScene-to-SVG renderer
measureTextChartTextMeasurerHost measurerGuide text measurement
onFocusChange(point: ChartPoint | null) => voidNonePrimary focus callback
onFocusGroupChange(points: readonly ChartPoint[]) => voidNoneGrouped focus callback
onSelect(point: ChartPoint | null) => voidNonePointer or keyboard activation callback
onRender(context: ChartRenderContext) => voidNoneLive SVG, container, and scene after rendering
renderTooltipBody(context: ChartTooltipBodyRenderContext) => JSX.ElementNoneComposes Solid content inside the native tooltip body
classstringNoneExtra class on the outer .ts-chart-host
styleJSX.CSSPropertiesNoneOuter host styles applied after adapter sizing
classNamestringNoneExtra class on the rendered SVG surface

renderTooltipBody receives points, content, defaultBody, pinned, and dismiss. Include defaultBody to keep the native title, rows, formatting, and swatches. Ordering, anchoring, placement, portaling, and pinning remain in the definition. Read fields from the callback context instead of destructuring its parameter so Solid tracks focused-point and pinned-state changes.

Exported types

ChartCommonProps contains the common host and presentation props. ChartProps adds the definition. ChartPresentationProps contains class and style. ChartTooltipBodyRenderContext describes composed tooltip content. The package also re-exports ChartDefinition and ChartPoint.

See the Solid adapter for lifecycle and SSR behavior, Focus and interaction for callback semantics, and Rendering and export for custom SVG renderers.