Docs

Charts guide

Charts use Recharts component and parameter names. Child functions return descriptors that Foldkit renders as SVG.

Install the chart source into a Foldkit app, pass your data rows and child descriptors, and route hover messages through your update function. A responsive chart needs a container with a measurable width.

Cartesian and polar rows contain scalar string or number values. Treemap, SunburstChart, and FunnelChart use nested nodes; Sankey uses nodes and links. Active cartesian hover state belongs to the caller.

The API pages list the currently supported parameters. Every chart example on the Recharts index has a lazy Foldkit preview and source. Examples with upstream behavior still in progress are labeled as adaptations.

Start with a line chart

import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend } from '@/components/ui/line-chart'

LineChart({
  data,
  responsive: true,
  children: [
    CartesianGrid({ strokeDasharray: '3 3' }),
    XAxis({ dataKey: 'name' }),
    YAxis(),
    Tooltip(),
    Legend(),
    Line({ dataKey: 'value', type: 'monotone', stroke: '#2563eb' }),
  ],
  activeIndex: model.activeIndex,
  onActiveIndexChange: (index) => Message.ChartHovered({ index }),
}, h)
LineChart API and examples →