Renders a single label in a chart. The Label component displays text at a specific position, often used to annotate axes, data points, or chart areas.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/recharts/recharts/llms.txt
Use this file to discover all available pages before exploring further.
Usage
Props
Content
The value of the label.Can also be set as children:
<Label>foo</Label>Alternative way to set the label value.Can also be set via the
value prop: <Label value="foo" />Custom content for the label.Options:
ReactElement: Custom label elementfunction: Render function that receives label props and returns a React element
Position
The position of the label relative to the view box.Cartesian positions:
top,bottom,left,righttopLeft,topRight,bottomLeft,bottomRightinsideLeft,insideRight,insideTop,insideBottominsideTopLeft,insideTopRight,insideBottomLeft,insideBottomRightcenter,centerTop,centerBottommiddle
insideStart,insideEnd,endoutside,center,centerTop,centerBottom
The offset to the specified position.Direction of the offset depends on the position.
View box
The box of the viewing area, used for positioning.If undefined, viewBox is calculated based on surrounding context.
The parent view box, used for positioning calculations.
Text formatting
Function to customize how content is serialized before rendering.Should return renderable text (string or number).Signature:
(label: RenderableText) => RenderableTextAppearance
Text rotation angle in degrees.Positive values rotate clockwise, negative values rotate counterclockwise.
If true, enables character-level breaking instead of word-level breaking.
The fill color of the label text.
The stroke color of the label text.
The font size of the label text.
The font family of the label text.
The font weight of the label text.
Display
The z-index of the label.Higher values render on top of lower values.
Other
CSS class name for the label element.
Unique identifier of this component.Used as an HTML attribute
id.The index of this label in a series of labels.
Context
The Label component consumes context from:- CartesianViewBoxContext
- PolarViewBoxContext
- CartesianLabelContext
- PolarLabelContext