Components

Line Chart

Compose a line chart with axes, lines and tooltips.

Loading chart…

Visitors
MonthVisitors
Jan420
Feb580
Mar510
Apr760
May680
Jun910
Jul840
Aug1070
Sep960
Oct1180
Nov1110
Dec1360

Usage

Pass data and config to LineChart. Customize its defaults or compose plot parts as children.

legend={{}} enables the internally positioned Chart.Legend; LineChart owns its context and placement.

Imports
import * as Chart from "@kind-ui/charts";
import "@kind-ui/charts/styles.css";
Composition
<Chart.LineChart data={data} config={config} legend={{}} aria-label="Monthly visitors">
  <Chart.CartesianGrid vertical={false} />
  <Chart.XAxis dataKey="period" />
  <Chart.YAxis />
  <Chart.LineSeries dataKey="visitors" type="monotone" />
  <Chart.Tooltip />
</Chart.LineChart>

The grid guides comparison, axes label the scale, LineSeries draws the values, and Tooltip shows the inspected point. Omit explicit children and pass xDataKey="period" to use generated parts.

Curve types

Choose smooth, linear or step-after interpolation. The code follows the selected curve.

Loading chart…

Visitors
MonthVisitors
Jan420
Feb580
Mar510
Apr760
May680
Jun910
Jul840
Aug1070
Sep960
Oct1180
Nov1110
Dec1360

Multiple series

Compare revenue with a dashed target. Use the legend to hide either series.

Loading chart…

Revenue and target ($ thousands)
MonthRevenue ($k)Target ($k)
Jan4248
Feb5854
Mar5160
Apr7666
May6872
Jun9178
Jul8484
Aug10790
Sep9696
Oct118102
Nov111108
Dec136114

Dots and labels

Explicit children add diamond markers and labels. LineChart still owns sizing, visibility and motion.

Loading chart…

Response time (milliseconds)
DayResponse time (ms)
Mon140
Tue128
Wed156
Thu119
Fri134
Sat108
Sun121

Materials

Choose plain, paper, clay or glow.

Loading chart…

Visitors
MonthVisitors
Jan420
Feb580
Mar510
Apr760
May680
Jun910
Jul840
Aug1070
Sep960
Oct1180
Nov1110
Dec1360

API reference

Passing config enables the defaults below. Omit config for the existing Root + LineChart composition.

LineChart

Configured LineChart owns its Root; do not wrap it in another one. Each config key generates a series unless you provide series or explicit children.

PropTypeDefaultDescription
datareadonly Row[]RequiredObservations to plot.
configSeriesConfigRequired in configured modeSeries labels, colors and optional value formatters.
xDataKeyDataKey<Row>Required with generated partsField or accessor for x-axis labels. Omit with explicit children.
aria-label / aria-labelledbystringOne requiredAccessible chart name. Keyboard inspection instructions are provided.
height / widthNative chart dimensions280px / 100%Responsive plot dimensions; style and className can also override sizing.
curveRecharts curve type"monotone"Curve for generated series; use "linear" or "stepAfter" here.
material"plain" | "paper" | "clay" | "glow""plain"Finish for generated series, including "paper".
seriesConfiguredLineSeries<Row>[]Config keysPer-series props; each entry needs dataKey and a unique seriesKey in config.
xAxis / yAxis / gridNative props or falseStyled axes and horizontal gridOverride generated parts or hide them.
tooltip / legendKind props or falseEnabled with generated partsOverride or hide the tooltip and legend. Explicit children need legend={{}} to add a legend.
animateboolean or LineAnimationtrue configured; false legacyEntrance and emphasis motion; respects reduced motion.
defaultVisibleSeriesreadonly string[]All seriesInitial uncontrolled selection. Legend toggles update it automatically.
visibleSeries / onVisibleSeriesChangereadonly string[] / callbackUncontrolledProvide both for controlled toggles. Without a callback, controlled visibility is read-only.
childrenReactNodeGenerated partsExplicit children replace the plot parts, including null or an empty fragment.

With explicit children, omit xDataKey, curve, material, series and generated-part options. Keep visibility mode stable or remount to change it. See Recharts LineChart for native plot props.

LineSeries

Use LineSeries inside explicit children, or pass its props in the configured series array. String dataKey values identify their config entry; seriesKey supplies a separate identity for accessor or numeric keys.

PropTypeDefaultDescription
dataKeyDataKey<Row>RequiredValue field or accessor.
seriesKeystringString dataKeyConfig and visibility identity; required in a series array.
typeRecharts curve type"linear" explicit; "monotone" generatedCurve for this line.
material"plain" | "paper" | "clay" | "glow""plain"Line finish; custom shape or filter takes precedence.
dotNative dot props or renderertrue explicit; radius 2.5 generatedPoint markers; use false to hide them.
strokeWidth / strokeDasharraynumber / stringWidth 1 explicit / 2 generated; no dashesStroke weight and dash pattern.

Missing values remain gaps unless connectNulls is enabled. See Recharts Line for native marks and material support for finishes.

Shared components

Root, SeriesConfig, Legend, Tooltip, Axes and grid, ResponsiveContainer, Labels and cells.