Tooltip API
The API documentation of the Tooltip React component. Learn more about the props and the CSS customization points.
Import
import Tooltip from '@material-ui/core/Tooltip';
// or
import { Tooltip } from '@material-ui/core';
You can learn more about the difference by reading this guide.
Component name
The MuiTooltip
name can be used for providing default props or style overrides at the theme level.
Props
Name | Type | Default | Description |
---|---|---|---|
arrow | bool | false | If true , adds an arrow to the tooltip. |
children* | element | Tooltip reference element. ⚠️ Needs to be able to hold a ref. |
|
classes | object | Override or extend the styles applied to the component. See CSS API below for more details. | |
disableFocusListener | bool | false | Do not respond to focus events. |
disableHoverListener | bool | false | Do not respond to hover events. |
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 (enterTouchDelay ). |
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. |
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. | |
interactive | bool | false | Makes a tooltip interactive, i.e. will not close when the user hovers over the tooltip before the leaveDelay is expired. |
leaveDelay | number | 0 | The number of milliseconds to wait before hiding the tooltip. This prop won't impact the leave touch delay (leaveTouchDelay ). |
leaveTouchDelay | number | 1500 | The number of milliseconds after the user stops touching an element before hiding the tooltip. |
onClose | func | Callback fired when the component requests to be closed. Signature: function(event: object) => void event: The event source of the callback. |
|
onOpen | func | Callback fired when the component requests to be open. Signature: function(event: object) => void event: The event source of the callback. |
|
open | bool | If true , the tooltip 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. |
PopperComponent | elementType | Popper | The component used for the popper. |
PopperProps | object | Props applied to the Popper element. |
|
title* | node | Tooltip title. Zero-length titles string are never displayed. | |
TransitionComponent | elementType | Grow | The component used for the transition. Follow this guide to learn more about the requirements for this component. |
TransitionProps | object | Props applied to the Transition element. |
The ref
is forwarded to the root element.
Any other props supplied will be provided to the root element (native element).
CSS
Rule name | Global class | Description |
---|---|---|
popper | .MuiTooltip-popper | Styles applied to the Popper component. |
popperInteractive | .MuiTooltip-popperInteractive | Styles applied to the Popper component if interactive={true} . |
popperArrow | .MuiTooltip-popperArrow | Styles applied to the Popper component if arrow={true} . |
tooltip | .MuiTooltip-tooltip | Styles applied to the tooltip (label wrapper) element. |
tooltipArrow | .MuiTooltip-tooltipArrow | Styles applied to the tooltip (label wrapper) element if arrow={true} . |
arrow | .MuiTooltip-arrow | Styles applied to the arrow element. |
touch | .MuiTooltip-touch | Styles applied to the tooltip (label wrapper) element if the tooltip is opened by touch. |
tooltipPlacementLeft | .MuiTooltip-tooltipPlacementLeft | Styles applied to the tooltip (label wrapper) element if placement contains "left". |
tooltipPlacementRight | .MuiTooltip-tooltipPlacementRight | Styles applied to the tooltip (label wrapper) element if placement contains "right". |
tooltipPlacementTop | .MuiTooltip-tooltipPlacementTop | Styles applied to the tooltip (label wrapper) element if placement contains "top". |
tooltipPlacementBottom | .MuiTooltip-tooltipPlacementBottom | Styles applied to the tooltip (label wrapper) element if placement contains "bottom". |
You can override the style of the component thanks to one of these customization points:
- With a rule name of the
classes
object prop. - With a global class name.
- With a theme and an
overrides
property.
If that's not sufficient, you can check the implementation of the component for more detail.