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';
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
children* | element | - | Tooltip reference element. |
arrow | bool | false | If |
color | 'danger' | '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. |
component | elementType | - | The component used for the root node. Either a string to use a HTML element or a component. |
describeChild | bool | false | Set to |
direction | 'ltr' | 'rtl' | 'ltr' | Direction of the text. |
disableFocusListener | bool | false | Do not respond to focus-visible events. |
disableHoverListener | bool | false | Do not respond to hover events. |
disableInteractive | bool | false | Makes a tooltip not interactive, i.e. it will close when the user hovers over the tooltip before the |
disablePortal | bool | false | The |
disableTouchListener | bool | false | Do not respond to long press touch events. |
enterDelay | number | 100 | The number of milliseconds to wait before showing the tooltip. This prop won't impact the enter touch delay ( |
enterNextDelay | number | 0 | The number of milliseconds to wait before showing the tooltip when one was already recently opened. |
enterTouchDelay | number | 700 | The number of milliseconds a user must touch the element before showing the tooltip. |
followCursor | bool | false | If |
id | string | - | 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. |
keepMounted | bool | false | 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. |
leaveDelay | number | 0 | The number of milliseconds to wait before hiding the tooltip. This prop won't impact the leave touch delay ( |
leaveTouchDelay | number | 1500 | The number of milliseconds after the user stops touching an element before hiding the tooltip. |
modifiers | 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> }> | - | Popper.js is based on a "plugin-like" architecture, most of its features are fully encapsulated "modifiers". |
onClose | func | - | Callback fired when the component requests to be closed. Signature: function(event: React.SyntheticEvent) => void
|
onOpen | func | - | Callback fired when the component requests to be open. Signature: function(event: React.SyntheticEvent) => void
|
open | bool | - | If |
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. |
sx | Array<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. |
title | node | - | 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. |
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.
To learn how to customize the slot, check out the Overriding component structure guide.
Slot name | Class name | Default component | Description |
---|---|---|---|
root | .MuiTooltip-root | 'div' | The component that renders the root. |
arrow | .MuiTooltip-arrow | 'span' | The component that renders the arrow. |
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 |
---|---|---|
.MuiTooltip-colorContext | colorContext | Class name applied to the root element when color inversion is triggered. |
.MuiTooltip-colorDanger | colorDanger | Class name applied to the root element if color="danger" . |
.MuiTooltip-colorNeutral | colorNeutral | Class name applied to the root element if color="neutral" . |
.MuiTooltip-colorPrimary | colorPrimary | Class name applied to the root element if color="primary" . |
.MuiTooltip-colorSuccess | colorSuccess | Class name applied to the root element if color="success" . |
.MuiTooltip-colorWarning | colorWarning | Class name applied to the root element if color="warning" . |
.MuiTooltip-placementBottom | placementBottom | Class name applied to the root element if placement contains "bottom". |
.MuiTooltip-placementLeft | placementLeft | Class name applied to the root element if placement contains "left". |
.MuiTooltip-placementRight | placementRight | Class name applied to the root element if placement contains "right". |
.MuiTooltip-placementTop | placementTop | Class name applied to the root element if placement contains "top". |
.MuiTooltip-sizeLg | sizeLg | Class name applied to the root element if size="lg" . |
.MuiTooltip-sizeMd | sizeMd | Class name applied to the root element if size="md" . |
.MuiTooltip-sizeSm | sizeSm | Class name applied to the root element if size="sm" . |
.MuiTooltip-tooltipArrow | tooltipArrow | Class name applied to the root element if arrow={true} . |
.MuiTooltip-touch | touch | Class name applied to the root element if the tooltip is opened by touch. |
.MuiTooltip-variantOutlined | variantOutlined | Class name applied to the root element if variant="outlined" . |
.MuiTooltip-variantPlain | variantPlain | Class name applied to the root element if variant="plain" . |
.MuiTooltip-variantSoft | variantSoft | Class name applied to the root element if variant="soft" . |
.MuiTooltip-variantSolid | variantSolid | Class name applied to the root element if variant="solid" . |
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
styleOverrides
property in a custom theme.