Line Chart
Compose a line chart with axes, lines and tooltips.
Loading chart…
| Month | Visitors |
|---|---|
| Jan | 420 |
| Feb | 580 |
| Mar | 510 |
| Apr | 760 |
| May | 680 |
| Jun | 910 |
| Jul | 840 |
| Aug | 1070 |
| Sep | 960 |
| Oct | 1180 |
| Nov | 1110 |
| Dec | 1360 |
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.
import * as Chart from "@kind-ui/charts";
import "@kind-ui/charts/styles.css";<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…
| Month | Visitors |
|---|---|
| Jan | 420 |
| Feb | 580 |
| Mar | 510 |
| Apr | 760 |
| May | 680 |
| Jun | 910 |
| Jul | 840 |
| Aug | 1070 |
| Sep | 960 |
| Oct | 1180 |
| Nov | 1110 |
| Dec | 1360 |
Multiple series
Compare revenue with a dashed target. Use the legend to hide either series.
Loading chart…
| Month | Revenue ($k) | Target ($k) |
|---|---|---|
| Jan | 42 | 48 |
| Feb | 58 | 54 |
| Mar | 51 | 60 |
| Apr | 76 | 66 |
| May | 68 | 72 |
| Jun | 91 | 78 |
| Jul | 84 | 84 |
| Aug | 107 | 90 |
| Sep | 96 | 96 |
| Oct | 118 | 102 |
| Nov | 111 | 108 |
| Dec | 136 | 114 |
Dots and labels
Explicit children add diamond markers and labels. LineChart still owns sizing, visibility and motion.
Loading chart…
| Day | Response time (ms) |
|---|---|
| Mon | 140 |
| Tue | 128 |
| Wed | 156 |
| Thu | 119 |
| Fri | 134 |
| Sat | 108 |
| Sun | 121 |
Materials
Choose plain, paper, clay or glow.
Loading chart…
| Month | Visitors |
|---|---|
| Jan | 420 |
| Feb | 580 |
| Mar | 510 |
| Apr | 760 |
| May | 680 |
| Jun | 910 |
| Jul | 840 |
| Aug | 1070 |
| Sep | 960 |
| Oct | 1180 |
| Nov | 1110 |
| Dec | 1360 |
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.
| Prop | Type | Default | Description |
|---|---|---|---|
data | readonly Row[] | Required | Observations to plot. |
config | SeriesConfig | Required in configured mode | Series labels, colors and optional value formatters. |
xDataKey | DataKey<Row> | Required with generated parts | Field or accessor for x-axis labels. Omit with explicit children. |
aria-label / aria-labelledby | string | One required | Accessible chart name. Keyboard inspection instructions are provided. |
height / width | Native chart dimensions | 280px / 100% | Responsive plot dimensions; style and className can also override sizing. |
curve | Recharts curve type | "monotone" | Curve for generated series; use "linear" or "stepAfter" here. |
material | "plain" | "paper" | "clay" | "glow" | "plain" | Finish for generated series, including "paper". |
series | ConfiguredLineSeries<Row>[] | Config keys | Per-series props; each entry needs dataKey and a unique seriesKey in config. |
xAxis / yAxis / grid | Native props or false | Styled axes and horizontal grid | Override generated parts or hide them. |
tooltip / legend | Kind props or false | Enabled with generated parts | Override or hide the tooltip and legend. Explicit children need legend={{}} to add a legend. |
animate | boolean or LineAnimation | true configured; false legacy | Entrance and emphasis motion; respects reduced motion. |
defaultVisibleSeries | readonly string[] | All series | Initial uncontrolled selection. Legend toggles update it automatically. |
visibleSeries / onVisibleSeriesChange | readonly string[] / callback | Uncontrolled | Provide both for controlled toggles. Without a callback, controlled visibility is read-only. |
children | ReactNode | Generated parts | Explicit 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.
| Prop | Type | Default | Description |
|---|---|---|---|
dataKey | DataKey<Row> | Required | Value field or accessor. |
seriesKey | string | String dataKey | Config and visibility identity; required in a series array. |
type | Recharts curve type | "linear" explicit; "monotone" generated | Curve for this line. |
material | "plain" | "paper" | "clay" | "glow" | "plain" | Line finish; custom shape or filter takes precedence. |
dot | Native dot props or renderer | true explicit; radius 2.5 generated | Point markers; use false to hide them. |
strokeWidth / strokeDasharray | number / string | Width 1 explicit / 2 generated; no dashes | Stroke 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.