Tooltip API
Demos
For examples and details on the usage of this React component, visit the component demo pages:
Import
import Tooltip from '@mui/joy/Tooltip';
// or
import { Tooltip } from '@mui/joy';
Component name
The nameJoyTooltip
can be used when providing default props or style overrides in the theme.Props
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
children* | element | Tooltip reference element. | |
arrow | bool | false | If true , adds an arrow to the tooltip. |
color | 'danger' | 'info' | 'neutral' | 'primary' | 'success' | 'warning' | 'neutral' | The color of the component. It supports those theme colors that make sense for this component. |
describeChild | bool | false | Set to true if the title acts as an accessible description. By default the title acts as an accessible label for the child. |
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 leaveDelay is expired. |
disablePortal | bool | false | The children will be under the DOM hierarchy of the parent component. |
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. |
followCursor | bool | false | If true , the tooltip follow the cursor over the wrapped element. |
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 ). |
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". 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. | |
onClose | func | Callback fired when the component requests to be closed. Signature: function(event: React.SyntheticEvent) => void event: The event source of the callback. | |
onOpen | func | Callback fired when the component requests to be open. Signature: function(event: React.SyntheticEvent) => void event: The event source of the callback. | |
open | bool | If true , the component 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. |
size | 'sm' | 'md' | 'lg' | 'md' | The size of the component. |
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 variant to use. |
The
ref
is forwarded to the root element.