> ## 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.

# Label

> Renders a single label in a chart

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.

## Usage

```tsx theme={null}
import { LineChart, Line, XAxis, Label } from 'recharts';

<LineChart width={500} height={300} data={data}>
  <XAxis dataKey="name">
    <Label value="Date" position="insideBottom" />
  </XAxis>
  <Line dataKey="uv" />
</LineChart>
```

## Props

### Content

<ParamField path="value" type="string | number">
  The value of the label.

  Can also be set as children: `<Label>foo</Label>`
</ParamField>

<ParamField path="children" type="string | number">
  Alternative way to set the label value.

  Can also be set via the `value` prop: `<Label value="foo" />`
</ParamField>

<ParamField path="content" type="ReactElement | function">
  Custom content for the label.

  Options:

  * `ReactElement`: Custom label element
  * `function`: Render function that receives label props and returns a React element
</ParamField>

### Position

<ParamField path="position" type="LabelPosition" default="middle">
  The position of the label relative to the view box.

  Cartesian positions:

  * `top`, `bottom`, `left`, `right`
  * `topLeft`, `topRight`, `bottomLeft`, `bottomRight`
  * `insideLeft`, `insideRight`, `insideTop`, `insideBottom`
  * `insideTopLeft`, `insideTopRight`, `insideBottomLeft`, `insideBottomRight`
  * `center`, `centerTop`, `centerBottom`
  * `middle`

  Polar positions:

  * `insideStart`, `insideEnd`, `end`
  * `outside`, `center`, `centerTop`, `centerBottom`
</ParamField>

<ParamField path="offset" type="number" default="5">
  The offset to the specified position.

  Direction of the offset depends on the position.
</ParamField>

### View box

<ParamField path="viewBox" type="ViewBox">
  The box of the viewing area, used for positioning.

  If undefined, viewBox is calculated based on surrounding context.
</ParamField>

<ParamField path="parentViewBox" type="ViewBox">
  The parent view box, used for positioning calculations.
</ParamField>

### Text formatting

<ParamField path="formatter" type="function">
  Function to customize how content is serialized before rendering.

  Should return renderable text (string or number).

  Signature: `(label: RenderableText) => RenderableText`
</ParamField>

### Appearance

<ParamField path="angle" type="number" default="0">
  Text rotation angle in degrees.

  Positive values rotate clockwise, negative values rotate counterclockwise.
</ParamField>

<ParamField path="textBreakAll" type="boolean" default="false">
  If true, enables character-level breaking instead of word-level breaking.
</ParamField>

<ParamField path="fill" type="string">
  The fill color of the label text.
</ParamField>

<ParamField path="stroke" type="string">
  The stroke color of the label text.
</ParamField>

<ParamField path="fontSize" type="number">
  The font size of the label text.
</ParamField>

<ParamField path="fontFamily" type="string">
  The font family of the label text.
</ParamField>

<ParamField path="fontWeight" type="string | number">
  The font weight of the label text.
</ParamField>

### Display

<ParamField path="zIndex" type="number" default="2000">
  The z-index of the label.

  Higher values render on top of lower values.
</ParamField>

### Other

<ParamField path="className" type="string">
  CSS class name for the label element.
</ParamField>

<ParamField path="id" type="string">
  Unique identifier of this component.

  Used as an HTML attribute `id`.
</ParamField>

<ParamField path="index" type="number">
  The index of this label in a series of labels.
</ParamField>

## Context

The Label component consumes context from:

* CartesianViewBoxContext
* PolarViewBoxContext
* CartesianLabelContext
* PolarLabelContext

When rendered as a child of an axis or graphical element, the viewBox is automatically provided.
