Skip to content

Tooltip API

API reference docs for the React Tooltip component. Learn about the props, CSS, and other APIs of this exported module.

Demos

For examples and details on the usage of this React component, visit the component demo pages:

Import

import Tooltip from '@mui/joy/Tooltip';
// or
import { Tooltip } from '@mui/joy';
You can learn about the difference by reading this guide on minimizing bundle size.

Props

Props of the native component are also available.

NameTypeDefaultDescription
children*element
Tooltip reference element.
arrowboolfalse
If true, adds an arrow to the tooltip.
color'danger'
| 'info'
| 'neutral'
| 'primary'
| 'success'
| 'warning'
'neutral'
The color of the component. It supports those theme colors that make sense for this component. To learn how to add your own colors, check out Themed components—Extend colors.
componentelementType
The component used for the root node. Either a string to use a HTML element or a component.
describeChildboolfalse
Set to true if the title acts as an accessible description. By default the title acts as an accessible label for the child.
direction'ltr'
| 'rtl'
'ltr'
Direction of the text.
disableFocusListenerboolfalse
Do not respond to focus-visible events.
disableHoverListenerboolfalse
Do not respond to hover events.
disableInteractiveboolfalse
Makes a tooltip not interactive, i.e. it will close when the user hovers over the tooltip before the leaveDelay is expired.
disablePortalboolfalse
The children will be under the DOM hierarchy of the parent component.
disableTouchListenerboolfalse
Do not respond to long press touch events.
enterDelaynumber100
The number of milliseconds to wait before showing the tooltip. This prop won't impact the enter touch delay (enterTouchDelay).
enterNextDelaynumber0
The number of milliseconds to wait before showing the tooltip when one was already recently opened.
enterTouchDelaynumber700
The number of milliseconds a user must touch the element before showing the tooltip.
followCursorboolfalse
If true, the tooltip follow the cursor over the wrapped element.
idstring
This prop is used to help implement the accessibility logic. If you don't provide this prop. It falls back to a randomly generated id.
keepMountedboolfalse
Always keep the children in the DOM. This prop can be useful in SEO situation or when you want to maximize the responsiveness of the Popper.
leaveDelaynumber0
The number of milliseconds to wait before hiding the tooltip. This prop won't impact the leave touch delay (leaveTouchDelay).
leaveTouchDelaynumber1500
The number of milliseconds after the user stops touching an element before hiding the tooltip.
modifiersArray<{ data?: object, effect?: func, enabled?: bool, fn?: func, name?: any, options?: object, phase?: 'afterMain'
| 'afterRead'
| 'afterWrite'
| 'beforeMain'
| 'beforeRead'
| 'beforeWrite'
| 'main'
| 'read'
| 'write', requires?: Array<string>, requiresIfExists?: Array<string> }>
Popper.js is based on a "plugin-like" architecture, most of its features are fully encapsulated "modifiers".
A modifier is a function that is called each time Popper.js needs to compute the position of the popper. For this reason, modifiers should be very performant to avoid bottlenecks. To learn how to create a modifier, read the modifiers documentation.
onClosefunc
Callback fired when the component requests to be closed.

Signature:
function(event: React.SyntheticEvent) => void
event: The event source of the callback.
onOpenfunc
Callback fired when the component requests to be open.

Signature:
function(event: React.SyntheticEvent) => void
event: The event source of the callback.
openbool
If true, the component is shown.
placement'bottom-end'
| 'bottom-start'
| 'bottom'
| 'left-end'
| 'left-start'
| 'left'
| 'right-end'
| 'right-start'
| 'right'
| 'top-end'
| 'top-start'
| 'top'
'bottom'
Tooltip placement.
size'sm'
| 'md'
| 'lg'
'md'
The size of the component. To learn how to add custom sizes to the component, check out Themed components—Extend sizes.
slotProps{ arrow?: func
| object, root?: func
| object }
{}
The props used for each slot inside.
slots{ arrow?: elementType, root?: elementType }{}
The components used for each slot inside. See Slots API below for more details.
sxArray<func
| object
| bool>
| func
| object
The system prop that allows defining system overrides as well as additional CSS styles. See the `sx` page for more details.
titlenode
Tooltip title. Zero-length titles string, undefined, null and false are never displayed.
variant'outlined'
| 'plain'
| 'soft'
| 'solid'
'solid'
The global variant to use. To learn how to add your own variants, check out Themed components—Extend variants.

The ref is forwarded to the root element.

Theme default props

You can use JoyTooltip to change the default props of this component with the theme.

Slots

To learn how to customize the slot, check out the Overriding component structure guide.

NameDefault classDefault HTML tagDescription
root.MuiTooltip-root'div'The component that renders the root.
arrow.MuiTooltip-arrow'span'The component that renders the arrow.

You can override the style of the component using one of these customization options:

CSS classes

These class names are useful for styling with CSS. They are applied to the root slot when specific states are triggered.

Global classDescription
.MuiTooltip-colorContextClass name applied to the root element when color inversion is triggered.
.MuiTooltip-colorDangerClass name applied to the root element if color="danger".
.MuiTooltip-colorInfoClass name applied to the root element if color="info".
.MuiTooltip-colorNeutralClass name applied to the root element if color="neutral".
.MuiTooltip-colorPrimaryClass name applied to the root element if color="primary".
.MuiTooltip-colorSuccessClass name applied to the root element if color="success".
.MuiTooltip-colorWarningClass name applied to the root element if color="warning".
.MuiTooltip-placementBottomClass name applied to the root element if placement contains "bottom".
.MuiTooltip-placementLeftClass name applied to the root element if placement contains "left".
.MuiTooltip-placementRightClass name applied to the root element if placement contains "right".
.MuiTooltip-placementTopClass name applied to the root element if placement contains "top".
.MuiTooltip-sizeLgClass name applied to the root element if size="lg".
.MuiTooltip-sizeMdClass name applied to the root element if size="md".
.MuiTooltip-sizeSmClass name applied to the root element if size="sm".
.MuiTooltip-tooltipArrowClass name applied to the root element if arrow={true}.
.MuiTooltip-touchClass name applied to the root element if the tooltip is opened by touch.
.MuiTooltip-variantOutlinedClass name applied to the root element if variant="outlined".
.MuiTooltip-variantPlainClass name applied to the root element if variant="plain".
.MuiTooltip-variantSoftClass name applied to the root element if variant="soft".
.MuiTooltip-variantSolidClass name applied to the root element if variant="solid".