ChartsTooltip API
API reference docs for the React ChartsTooltip component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
// or
import { ChartsTooltip } from '@mui/x-charts';
// or
import { ChartsTooltip } from '@mui/x-charts-pro/ChartsTooltip';
// or
import { ChartsTooltip } from '@mui/x-charts-pro';
// or
import { ChartsTooltip } from '@mui/x-charts-premium/ChartsTooltip';
// or
import { ChartsTooltip } from '@mui/x-charts-premium';Learn about the difference by reading this guide on minimizing bundle size.
| Name | Type | Default | Description |
|---|---|---|---|
| anchor | 'chart' | 'node' | 'pointer' | 'pointer' | Determine if the tooltip should be placed on the pointer location or on the node. |
| classes | Partial | - | Override or extend the styles applied to the component. See CSS classes API below for more details. |
| position | 'bottom' | 'left' | 'right' | 'top' | - | Determines the tooltip position relatively to the anchor. |
| slotProps | ChartsTooltipContainerSlotProps | {} | The props used for each component slot. |
| slots | ChartsTooltipContainerSlots | {} | Overridable component slots. See Slots API below for more details. |
| sort | 'asc' | 'desc' | 'none' | 'none' | Defines the sort order in which series items are displayed in the axis tooltip.
When set to |
| trigger | 'axis' | 'item' | 'none' | 'axis' | Select the kind of tooltip to display - 'item': Shows data about the item below the mouse; - 'axis': Shows values associated with the hovered x value; - 'none': Does not display tooltip. |
| Slot name | Class name | Default component | Description |
|---|---|---|---|
| root | .MuiChartsTooltip-root | 'div' | The component that renders the root. |
These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.
| Class name | Rule name | Description |
|---|---|---|
| .MuiChartsTooltip-axisValueCell | axisValueCell | Styles applied to the axisValueCell element. Only available for axis tooltip. |
| .MuiChartsTooltip-cell | cell | Styles applied to the cell element. |
| .MuiChartsTooltip-labelCell | labelCell | Styles applied to the labelCell element. |
| .MuiChartsTooltip-mark | mark | Styles applied to the mark element. |
| .MuiChartsTooltip-markContainer | markContainer | Styles applied to the markContainer element. |
| .MuiChartsTooltip-paper | paper | Styles applied to the paper element. |
| .MuiChartsTooltip-root | root | Styles applied to the root element. |
| .MuiChartsTooltip-row | row | Styles applied to the row element. |
| .MuiChartsTooltip-table | table | Styles applied to the table element. |
| .MuiChartsTooltip-valueCell | valueCell | Styles applied to the valueCell element. |
You can override the style of the component using one of these customization options:
- With a global class name.
- With a rule name as part of the component's
styleOverridesproperty in a custom theme.
Source code
If you did not find the information in this page, consider having a look at the implementation of the component for more detail.