Tooltip

Display additional information related to something with a tooltip.

Examples

Contents

UsageAPIs

Usage

Keep tooltips short if possible. If you need to render lots of information, try rendering custom content and breaking it apart instead of using pure text.

APIs

ITooltipProps

addAriaDescribedBy
boolean
When true, will add the aria-describedby attribute to the child using the getSafeId value of the tooltip id.
anchorOffset
IOffset
anchorOffset is used to shift the location of the callout from the defined location by a fixed amount. An example might be the tooltip callout defaults to an anchorOffset of { x: 8 y: 8 } from the mouse position.
anchorOrigin
IOrigin
When an anchorElement is supplied the anchorOrigin is used to describe the relative location of the callout with respect to the anchorElement.
className
string
CSS className to add to the tooltip.
delayMs250
number
When the tooltip shows up it is delayed by delayMs. This prevents the tooltip from blinking when the mouse goes over an element but doesnt hover for long enough. The default is 250ms.
disabledfalse
boolean
If the tooltip is marked disabled it wont be shown on its normal show condition like hover or focus.
fixedLayoutfalse
boolean
fixedLayout is used to determine whether or not the callout should be moved based on visibility. if fixedLayout is set to true the callout wont be moved.
id
string
Optional id for the tooltip container element.
overflowDetected
(anchorElement: HTMLElement) => boolean
Pass to use a custom function to check for overflow. By default, the anchorElement's scroll width is compared to the its offset width.
overflowOnlyfalse
boolean
Only show the tooltip if the contained element is larger than the element it is housed in. This is designed to help with showing the full text when an ellipsis it used to clip the text.
renderContent
() => React.ReactNode
renderContent can be used to render custom HTML inside the tooltip. NOTE: This shouldn't be used to create a custom Callout, use the Callout component, this should be used for helping users understand the details about a component on the page.
showOnFocustrue
boolean
Show the tooltip when the tooltip's children get focus. The component MUST be given content to show and not use the innerText that comes from overflowOnly.
text
string
Text to show when the tooltip is shown.
tooltipOrigin
IOrigin
tooltipOrigin works in conjunction with the other position styles; anchorElement, anchorOffset, anchorOrigin. After determining the location based on the anchor properties the position of the tooltip is applied.

Loaded Tooltip page