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';

Signature:

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

Parameters:

Parameter Type Description
newTargetEl HTMLElement The element to display the tooltip over.
content string | DocumentFragment The content of the tooltip.
options? TooltipOptions The options for the tooltip.

Returns: void

Example:

displayTooltip(document.body, 'foo');