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.

Component demos

Import

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

Props

Props of the native component are also available.

childrenRequired

Tooltip reference element.

Type:element


arrow

If true, adds an arrow to the tooltip.

Type:bool

Default:false


color

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.

Type:'danger'
| 'neutral'
| 'primary'
| 'success'
| 'warning'

Default:'neutral'


component

The component used for the root node. Either a string to use a HTML element or a component.

Type:elementType


describeChild

Set to true if the title acts as an accessible description. By default the title acts as an accessible label for the child.

Type:bool

Default:false


direction

Direction of the text.

Type:'ltr'
| 'rtl'

Default:'ltr'


disableFocusListener

Do not respond to focus-visible events.

Type:bool

Default:false


disableHoverListener

Do not respond to hover events.

Type:bool

Default:false


disableInteractive

Makes a tooltip not interactive, i.e. it will close when the user hovers over the tooltip before the leaveDelay is expired.

Type:bool

Default:false


disablePortal

The children will be under the DOM hierarchy of the parent component.

Type:bool

Default:false


disableTouchListener

Do not respond to long press touch events.

Type:bool

Default:false


enterDelay

The number of milliseconds to wait before showing the tooltip. This prop won't impact the enter touch delay (enterTouchDelay).

Type:number

Default:100


enterNextDelay

The number of milliseconds to wait before showing the tooltip when one was already recently opened.

Type:number

Default:0


enterTouchDelay

The number of milliseconds a user must touch the element before showing the tooltip.

Type:number

Default:700


followCursor

If true, the tooltip follow the cursor over the wrapped element.

Type:bool

Default:false


id

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.

Type:string


keepMounted

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.

Type:bool

Default:false


leaveDelay

The number of milliseconds to wait before hiding the tooltip. This prop won't impact the leave touch delay (leaveTouchDelay).

Type:number

Default:0


leaveTouchDelay

The number of milliseconds after the user stops touching an element before hiding the tooltip.

Type:number

Default:1500


modifiers

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.

Type:Array<{ 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> }>


onClose

Callback fired when the component requests to be closed.

Type:func

Signature:
function(event: React.SyntheticEvent) => void
  • event The event source of the callback.

onOpen

Callback fired when the component requests to be open.

Type:func

Signature:
function(event: React.SyntheticEvent) => void
  • event The event source of the callback.

open

If true, the component is shown.

Type:bool


placement

Tooltip placement.

Type:'bottom-end'
| 'bottom-start'
| 'bottom'
| 'left-end'
| 'left-start'
| 'left'
| 'right-end'
| 'right-start'
| 'right'
| 'top-end'
| 'top-start'
| 'top'

Default:'bottom'


size

The size of the component.

To learn how to add custom sizes to the component, check out Themed components—Extend sizes.

Type:'sm'
| 'md'
| 'lg'

Default:'md'


slotProps

The props used for each slot inside.

Type:{ arrow?: func
| object, root?: func
| object }

Default:{}


slots

The components used for each slot inside.

See Slots API below for more details.

Type:{ arrow?: elementType, root?: elementType }

Default:{}


sx

The system prop that allows defining system overrides as well as additional CSS styles.

See the `sx` page for more details.

Type:Array<func
| object
| bool>
| func
| object


title

Tooltip title. Zero-length titles string, undefined, null and false are never displayed.

Type:node


variant

The global variant to use.

To learn how to add your own variants, check out Themed components—Extend variants.

Type:'outlined'
| 'plain'
| 'soft'
| 'solid'

Default:'solid'


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.

root

The component that renders the root.

Class name: .MuiTooltip-root

Default component: 'div'


arrow

The component that renders the arrow.

Class name: .MuiTooltip-arrow

Default component: 'span'


CSS classes

These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.

.MuiTooltip-colorContext

Class name applied to the root element when color inversion is triggered.

Rule name:colorContext


.MuiTooltip-colorDanger

Class name applied to the root element if color="danger".

Rule name:colorDanger


.MuiTooltip-colorNeutral

Class name applied to the root element if color="neutral".

Rule name:colorNeutral


.MuiTooltip-colorPrimary

Class name applied to the root element if color="primary".

Rule name:colorPrimary


.MuiTooltip-colorSuccess

Class name applied to the root element if color="success".

Rule name:colorSuccess


.MuiTooltip-colorWarning

Class name applied to the root element if color="warning".

Rule name:colorWarning


.MuiTooltip-placementBottom

Class name applied to the root element if placement contains "bottom".

Rule name:placementBottom


.MuiTooltip-placementLeft

Class name applied to the root element if placement contains "left".

Rule name:placementLeft


.MuiTooltip-placementRight

Class name applied to the root element if placement contains "right".

Rule name:placementRight


.MuiTooltip-placementTop

Class name applied to the root element if placement contains "top".

Rule name:placementTop


.MuiTooltip-sizeLg

Class name applied to the root element if size="lg".

Rule name:sizeLg


.MuiTooltip-sizeMd

Class name applied to the root element if size="md".

Rule name:sizeMd


.MuiTooltip-sizeSm

Class name applied to the root element if size="sm".

Rule name:sizeSm


.MuiTooltip-tooltipArrow

Class name applied to the root element if arrow={true}.

Rule name:tooltipArrow


.MuiTooltip-touch

Class name applied to the root element if the tooltip is opened by touch.

Rule name:touch


.MuiTooltip-variantOutlined

Class name applied to the root element if variant="outlined".

Rule name:variantOutlined


.MuiTooltip-variantPlain

Class name applied to the root element if variant="plain".

Rule name:variantPlain


.MuiTooltip-variantSoft

Class name applied to the root element if variant="soft".

Rule name:variantSoft


.MuiTooltip-variantSolid

Class name applied to the root element if variant="solid".

Rule name:variantSolid



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

Edit this page

Was this page helpful?


ToggleButtonGroupTypography

•

Blog

•

Store