Docs/General Components/Label

Label

Label renders a single text label positioned in the chart's coordinate system. It's used by axes to display tick and axis labels, by reference elements (ReferenceLine, ReferenceDot, ReferenceArea), and can be nested inside series for inline labels.

import { LineChart, Line, Label } from "solid-recharts";

<LineChart width={500} height={300} data={data}>
  <Line dataKey="value">
    <Label value="Peak" position="top" offset={10} />
  </Line>
</LineChart>;
LabelList
bar-labels.tsxOpen ↗
Loading source...

Props

PropTypeDefaultDescription
valuestring | number—Label text (or set via children)
position"top" | "bottom" | "left" | "right" | "center" etc."middle"Placement relative to the element
offsetnumber5Distance from the element in pixels
anglenumber0Rotation in degrees
formatter(value) => string—Transform the label value before rendering
content(props) => JSX.Element—Render function for custom label content
textBreakAllbooleanfalseBreak text at character boundaries
classstring—CSS class applied to the label
childrenstring | number—Alternative to value prop

Valid position values: "top", "bottom", "left", "right", "inside", "outside", "insideLeft", "insideRight", "insideTop", "insideBottom", "center", "centerTop", "centerBottom", "middle", or an object { x: number, y: number } for absolute placement.

Notes

  • Label is often implicit — pass label={true} to a <Line> or <Bar> to show default labels, or label={<Label position="top" />} to customize.
  • The content render prop receives full label props; return any JSX element.
  • Works in both cartesian (LineChart, BarChart) and polar (PieChart, RadarChart) contexts.

See also

  • Text — low-level text rendering with wrapping
  • LabelList — labels for multiple data points
  • Bar · Line — series components with label support