Skip to content

displayTooltip

Official

Manually trigger a tooltip that will appear over the provided element. To display a tooltip on hover, use setTooltip instead.

Import:

import { displayTooltip } from 'obsidian';

Example:

displayTooltip(document.body, 'foo');

Signature:

function displayTooltip(newTargetEl: HTMLElement, content: string | DocumentFragment, options: TooltipOptions | undefined): void

Parameters:

ParameterTypeDescription
newTargetElHTMLElementThe element to display the tooltip over.
contentstring | DocumentFragmentThe content of the tooltip.
optionsTooltipOptions | undefinedThe options for the tooltip.

Returns: void

Example:

displayTooltip(document.body, 'foo');