Docs/Cartesian Components/Line

Line

Line is a graphical series component that renders a line (polyline) on a cartesian chart. It's typically used inside a LineChart container alongside axes and other components.

import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip } from "solid-recharts";

<LineChart width={500} height={300} data={data}>
  <CartesianGrid strokeDasharray="3 3" />
  <XAxis dataKey="name" />
  <YAxis />
  <Tooltip />
  <Line type="monotone" dataKey="value" stroke="#82ca9d" />
</LineChart>;
Line
line-dashed.tsxOpen ↗
Loading source...

Props

PropTypeDefaultDescription
dataKeystring | number | func—Data key or accessor for the line's values
typestring"linear"Curve interpolation: "linear", "monotone", "natural", etc
strokestring"#8884d8"Line color
strokeWidthnumber1Line thickness
strokeDasharraystring | number—Dashed pattern (e.g., "5 5")
connectNullsbooleanfalseConnect data points across null/undefined values
dotboolean | objecttrueRender dots at each point; true uses default, false hides
activeDotboolean | objecttrueDot appearance on hover; false disables
labelboolean | objectfalseRender labels at each point
isAnimationActiveboolean | "auto""auto"Enable enter/update animation

See the recharts Line docs for the full prop matrix.

Notes

  • Curve types: common types are "linear", "monotone", "natural", and "step"; see the d3-shape docs for the complete list.
  • Dashed lines: pass a dash pattern as a string (e.g., "5 5" for 5-unit dashes with 5-unit gaps).
  • Custom dots: set dot={{ r: 4 }} to customize the radius; use dot={false} to hide them entirely.
  • Multiple lines: each Line shares the chart's axes unless you assign it a unique xAxisId/yAxisId.

See also