Displays a floating tooltip with data values when hovering over or clicking on chart elements. The Tooltip component renders an HTML element (not SVG) that follows the cursor or attaches to specific data points.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
Renders the content of the tooltip.This should return HTML elements, not SVG elements.Options:
- Not set: Uses DefaultTooltipContent component
ReactElement: Element is cloned with extra propsfunction: Called to render HTML elements
Behavior
Controls when the tooltip appears.
hover: Shows on mouse enter, hides on mouse leaveclick: Shows after clicking, stays active
Defines whether the tooltip reacts to the current data point or all data points at the current axis coordinate.
true: Tooltip appears on top of all items at an axis tickfalse: Tooltip appears on individual items
Controls tooltip visibility.
true: Tooltip is always displayed once an activeIndex is setfalse: Tooltip is never displayedundefined: Recharts controls when tooltip displays
Position
If set, the tooltip displays at the specified position regardless of mouse position.You can set a single field (x or y) and let the other be calculated automatically.
The offset between the tooltip and the mouse cursor position.
- Number: Same offset for both x and y axes
- Coordinate: Different offsets for each axis
Allows the tooltip to extend beyond the viewBox of the chart.
Reverses the direction the tooltip appears relative to the cursor.
Styling
CSS styles applied to the wrapper
div element.CSS styles applied to the tooltip content element.
CSS styles applied to each tooltip item (li element).
CSS styles applied to the tooltip label (p element).
Cursor
Controls the cursor element shown when tooltip is active.Options:
false: No cursortrue: Default cursorobject: Props for cursor elementReactElement: Custom cursor elementfunction: Render function for custom cursor
Data formatting
Customizes the value in the tooltip.Signature:
(value, name, item, index, payload) => ReactNode | [ReactNode, ReactNode]If you return an array, the first entry is the formatted value, the second is the formatted name.Formats the tooltip label.Signature:
(label: any, payload: TooltipPayload) => ReactNodeThe separator between name and value.
Filtering
When true, items with null or undefined values are not displayed.
If true, the tooltip displays information about hidden series.
Function to determine uniqueness of tooltip items.
Sorts tooltip items.Default sorts alphabetically by graphical item
name property.Animation
If false, animation is disabled.If “auto”, animation is disabled in SSR and respects the user’s prefers-reduced-motion preference.
Duration of animation, in milliseconds.
The type of easing function.Options: ‘ease’, ‘ease-in’, ‘ease-out’, ‘ease-in-out’, ‘linear’
Portal
If defined, Tooltip uses this element as a target for rendering using React Portal.If undefined, Tooltip renders inside the recharts-wrapper element.
Advanced
The tooltip attaches to the “Tooltip axis” which depends on layout.Use this to specify which axis the tooltip uses.
Default active index for the tooltip.
If true, uses CSS translate3d for positioning.
Other
The label displayed in the tooltip.Automatically provided by chart context.
The array of data items to display.Automatically provided by chart context.
The coordinate where the tooltip should appear.Automatically provided by chart context.