Saltar al contenido

Tooltip API

API documentation for the React Tooltip component. Learn about the available props, and the CSS API.

Import

import Tooltip from '@material-ui/core/Tooltip';
// o
import { Tooltip } from '@material-ui/core';
You can learn about the difference by reading this guide on minimizing bundle size.

Component name

The name MuiTooltip can be used when providing default props or style overrides in the theme.

Props

NombreTipoPor defectoDescripción
children*elementTooltip reference element.
⚠️ Needs to be able to hold a ref.
title*nodeTooltip title. Zero-length titles string are never displayed.
arrowboolfalseIf true, adds an arrow to the tooltip.
classesobjectOverride or extend the styles applied to the component. See CSS API below for more details.
describeChildboolfalseSet to true if the title acts as an accessible description. By default the title acts as an accessible label for the child.
disableFocusListenerboolfalseDo not respond to focus events.
disableHoverListenerboolfalseDo not respond to hover events.
disableInteractiveboolfalseMakes a tooltip not interactive, i.e. it will close when the user hovers over the tooltip before the leaveDelay is expired.
disableTouchListenerboolfalseDo not respond to long press touch events.
enterDelaynumber100The number of milliseconds to wait before showing the tooltip. This prop won't impact the enter touch delay (enterTouchDelay).
enterNextDelaynumber0The number of milliseconds to wait before showing the tooltip when one was already recently opened.
enterTouchDelaynumber700The number of milliseconds a user must touch the element before showing the tooltip.
followCursorboolfalseIf true, the tooltip follow the cursor over the wrapped element.
idstringThis prop is used to help implement the accessibility logic. If you don't provide this prop. It falls back to a randomly generated id.
leaveDelaynumber0The number of milliseconds to wait before hiding the tooltip. This prop won't impact the leave touch delay (leaveTouchDelay).
leaveTouchDelaynumber1500The number of milliseconds after the user stops touching an element before hiding the tooltip.
onClosefuncCallback fired when the component requests to be closed.

Signature:
function(event: object) => void
event: The event source of the callback.
onOpenfuncCallback fired when the component requests to be open.

Signature:
function(event: object) => void
event: The event source of the callback.
openboolfalseControl the popup` open state.
placement'bottom-end'
| 'bottom-start'
| 'bottom'
| 'left-end'
| 'left-start'
| 'left'
| 'right-end'
| 'right-start'
| 'right'
| 'top-end'
| 'top-start'
| 'top'
'bottom'Tooltip placement.
PopperComponentelementTypePopperThe component used for the popper.
PopperPropsobject{}Props applied to the Popper element.
sxobject
TransitionComponentelementTypeGrowThe component used for the transition. Follow this guide to learn more about the requirements for this component.
TransitionPropsobjectProps applied to the transition element. By default, the element is based on this Transition component.

The ref is forwarded to the root element.
Any other props supplied will be provided to the root element (native element).

CSS

Rule nameGlobal classDescripción
popper.MuiTooltip-popperStyles applied to the Popper component.
popperInteractive.MuiTooltip-popperInteractiveStyles applied to the Popper component unless disableInteractive={true}.
popperArrow.MuiTooltip-popperArrowStyles applied to the Popper component if arrow={true}.
tooltip.MuiTooltip-tooltipStyles applied to the tooltip (label wrapper) element.
tooltipArrow.MuiTooltip-tooltipArrowStyles applied to the tooltip (label wrapper) element if arrow={true}.
arrow.MuiTooltip-arrowStyles applied to the arrow element.
touch.MuiTooltip-touchStyles applied to the tooltip (label wrapper) element if the tooltip is opened by touch.
tooltipPlacementLeft.MuiTooltip-tooltipPlacementLeftStyles applied to the tooltip (label wrapper) element if placement contains "left".
tooltipPlacementRight.MuiTooltip-tooltipPlacementRightStyles applied to the tooltip (label wrapper) element if placement contains "right".
tooltipPlacementTop.MuiTooltip-tooltipPlacementTopStyles applied to the tooltip (label wrapper) element if placement contains "top".
tooltipPlacementBottom.MuiTooltip-tooltipPlacementBottomStyles applied to the tooltip (label wrapper) element if placement contains "bottom".

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

Demos