Tooltip API
The API documentation of the Tooltip React component. Learn more about the properties and the CSS customization points.
import Tooltip from '@material-ui/core/Tooltip';
Props
Name | Type | Default | Description |
---|---|---|---|
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 | 0 | The number of milliseconds to wait before showing the tooltip. This property won't impact the enter touch delay (enterTouchDelay ). |
enterTouchDelay | number | 700 | The number of milliseconds a user must touch the element before showing the tooltip. |
id | string | The relationship between the tooltip and the wrapper component is not clear from the DOM. This property is used with aria-describedby to solve the accessibility issue. If you don't provide this property. 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 property 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 tooltip requests to be closed. Signature: function(event: object) => void event: The event source of the callback |
|
onOpen | func | Callback fired when the tooltip 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 | enum: 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top' |
'bottom' | Tooltip placement. |
PopperProps | object | Properties 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. |
TransitionProps | object | Properties applied to the Transition element. |
The component cannot hold a ref.
Any other properties supplied will be provided to the root element (native element).
CSS
You can override all the class names injected by Material-UI thanks to the classes
property.
This property accepts the following keys:
Name | Description |
---|---|
popper | Styles applied to the Popper component. |
popperInteractive | Styles applied to the Popper component if interactive={true} . |
tooltip | Styles applied to the tooltip (label wrapper) element. |
touch | Styles applied to the tooltip (label wrapper) element if the tooltip is opened by touch. |
tooltipPlacementLeft | Styles applied to the tooltip (label wrapper) element if placement contains "left". |
tooltipPlacementRight | Styles applied to the tooltip (label wrapper) element if placement contains "right". |
tooltipPlacementTop | Styles applied to the tooltip (label wrapper) element if placement contains "top". |
tooltipPlacementBottom | Styles applied to the tooltip (label wrapper) element if placement contains "bottom". |
Have a look at the overriding styles with classes section and the implementation of the component for more detail.
If using the overrides
key of the theme,
you need to use the following style sheet name: MuiTooltip
.
Notes
The component can cause issues in StrictMode.