About tanstack-charts
A coding skill for implementing and maintaining projects with the new TanStack Charts package. It covers chart composition, scales, interactions, rendering, SSR, and alpha-version migration guidance.
Key features
- 01Mark-based chart composition
- 02Scale registry and multiple axes
- 03Transforms, layouts, and interactions
- 04SVG and Canvas rendering guidance
- 05SSR, accessibility, and migration checks
Use cases
- 01Building charts with the unified package
- 02Configuring scales, axes, and tooltips
- 03Handling focus, selection, or zoom interactions
- 04Checking alpha APIs and migration changes
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ dobroslavradosavljevic/ skills --skill tanstack-chartsAfter installing, type/tanstack-chartsin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
agents/openai.yamlreferences/frameworks-interaction.mdmarks-composition.mdproduction-patterns.mdsetup-core.mdsource-map.mdtransforms-layouts.mdDetails
From the project READMETanStack Charts
Use this skill when work touches TanStack Charts, especially mark composition, transforms, the scales registry, compact vs D3 scales, React Chart, SSR, tooltips/focus, Canvas, optional motion(), React Native, spatial/hierarchy/network entries, or migrations.
Treat the library as Alpha (0.18.0 at skill refresh; official Alpha since 0.16.0). Alpha is for evaluation and early integration: minor releases may break APIs, so pin an exact version. Verify current docs and the npm latest version before relying on edge APIs. Prefer GitHub tag v0.18.0 docs over stale search, pre-Alpha snippets with root x / y, or archived react-charts.
Workflow
- Confirm the stack is the new TanStack Charts on the unified package:
- Correct:
bun add @tanstack/chartsplus framework peers. ImportChartfrom@tanstack/charts/react, scales from@tanstack/charts/scales/linear(and/band,/point,/ordinal). - Compatibility only:
@tanstack/react-charts,@tanstack/charts-scales, and other@tanstack/*-chartsadapter packages still exist for existing apps. Do not add them to new code. - Wrong: unscoped
react-charts, oroptions/primaryAxis/secondaryAxes/UserSerie.
- Correct:
- Refresh versions and URLs from source-map.md.
- Installation,
defineChart, thescalesregistry, named scales/multiple axes, axes and guide styles, legends, tooltip extensions: setup-core.md. - Marks, bar radii,
decorative, per-mark Canvas, polar/geo, composites: marks-composition.md. - Eager transforms vs mark layout: transforms-layouts.md.
- Adapters, sizing, focus, crosshair, brush/zoom/cursor/selection, motion, SSR: frameworks-interaction.md.
- Alpha stability, breaking migrations (root scales to
scales), testing, large data, Canvas, custom marks, AI checks: production-patterns.md.
Implementation Judgment
- A chart is a composition of marks, not a chart-type component. Prefer the smallest mark set that answers the question.
- Keep rows in their natural shape. Do not invent a library-owned series wrapper.
- Install one package:
@tanstack/charts. Compact scales: exact@tanstack/charts/scales/*(no/scalesbarrel). Import and declare everyd3-*the application source uses. Pass factories for inferred domains, or configured instances for fixed domains. Never assign pixel ranges to positional scales the chart owns. - Put positional scales in the
scalesregistry:scales: { x, y }is required on every definition (nullfor an unused dimension), and polar views usepolar({ scales: { angle, radius } }). Rootx/y/angle/radiuswere removed in0.16.0. Add named scales (channel,side) plus markxScale/yScaleonly for a genuine second axis. - Axis presentation lives under
axis/axis.ticks/axis.tickLabels.axis: falsehides a guide and keeps the scale. Set thescalesentry tonullonly when no mark uses that dimension. - Memoize the complete
defineChart(...)against every captured value. Definition identity is the update boundary. Responsive{ chart: ({ width }) => …, svgAnimation, tooltip, … }retains outer options. - Default SVG animation option is
svgAnimation, notanimate.motion()ignoressvgAnimationand reads definition-levelmotion. - Bars/areas with a single length channel stack implicitly. Use
layout: group()for side-by-side bars;layout: stack({ order, offset })only when order/offset must be explicit;y1/y2orx1/x2opts out. - Native tooltips:
tooltipfrom@tanstack/charts/tooltip. Escape clipping withportalfrom@tanstack/charts/tooltip/portal. ReactrenderTooltipBodyrequires@tanstack/charts/react/tooltip. Grouped rows default to visual mark order. - Channel and transform accessors use
(datum, { index, data }), not(datum, index, data). - Rolling transforms:
rollingWindow, notwindow. Reducer helper:delta, notdifference. - Supply
ariaLabelon every mounted chart. Usefocus: falseto omit generated focus geometry;focusRing: falsewhen authored focus marks replace the ring;focusDisabledwhen an app gesture owns the surface. Radial grouped focus:focusGroupAnglefrom@tanstack/charts/polar. - Default to SVG. For paint-heavy layers, attach
renderer: canvasChartRendererto those marks instead of switching the whole chart. Import polar, geo, Canvas, export, motion, spatial, hierarchy, network, brush/zoom only through exact subpaths. - Prefer built-in marks (
boxY,waffleY,violinY, composites) beforecreateMark. Wrap a sibling layer withdecorative(...)when only one layer should own hit-testing.
Verification
Prefer the repo's existing checks. For meaningful Charts work, include the relevant subset:
- Package check:
@tanstack/chartspinned to an exact0.18.x(or the project's pin). New code imports adapters/scales from that package, not@tanstack/react-charts/@tanstack/charts-scales. Definitions usescales.x/scales.y. - Typecheck for channels, scales, axis options, tooltip host brands, motion,
ChartPointcallbacks—no unexpected casts. createChartScene/renderChartSvgfor domains, geometry, keys, a11y markup.- Interaction tests: focus, keyboard, tooltip, selection, brush/zoom, resize, empty data, destroy.
- Light/dark smoke when theme tokens or tooltip surface CSS change.
- SSR/hydration smoke for
initialWidth, formatters, Canvas shells,idPrefix. - Bundle measurement when adding polar, geo, Canvas, export, motion, spatial, hierarchy, network, or extra D3 modules.