Shows supplementary information about an element when the user interacts with it, for example on hover or focus. It supports custom placement, delays, a sticky mode and animations.

Slots
default — The content of the tooltip. Replaces the `message` text.
close-button — Slot for custom sticky-mode close action (e.g., an icon/button).
CSS Parts
base — The wrapping container of the tooltip content.
simple-text — Added to the base part when the tooltip shows the `message` text, not slotted content.
close-button — The default sticky-mode close button.

An element instance or an IDREF to use as the anchor for the tooltip.

anchor: string | Element | undefined

The time in milliseconds before a hide trigger closes the tooltip. A negative value is the same as 0.

hideDelay: number

The anchor events that hide the tooltip. A list of event names, separated by commas or spaces.

hideTriggers: string
locale: string

The plain-text content of the tooltip. Slotted content replaces it.

message: string

The offset of the tooltip from the anchor in pixels.

offset: number

Whether the tooltip is showing.

open: boolean

Where to place the tooltip relative to its anchor element.

placement: PopoverPlacement
resourceStrings: TGet

The behavior of the tooltip when an ancestor scroll container scrolls.

If the value is hide, the tooltip hides while the anchor is fully out of view. hide is the default value.

If the value is scroll, the tooltip stays visible and anchored.

If the value is close, the tooltip closes on each scroll, also in sticky mode. The Escape key also closes a sticky tooltip.

scrollStrategy: PopoverScrollStrategy

The time in milliseconds before a show trigger opens the tooltip. A negative value is the same as 0.

showDelay: number

The anchor events that show the tooltip. A list of event names, separated by commas or spaces.

showTriggers: string

Whether the tooltip stays visible until the user closes it with the close button or the Escape key.

sticky: boolean

Whether to render an arrow indicator for the tooltip.

withArrow: boolean

Hides the tooltip if not already hidden.

hide(): Promise<boolean>

Returns Promise<boolean>

Shows the tooltip if not already showing. If a target is provided, sets it as a transient anchor.

show(target: string | Element): Promise<boolean>

Parameters

  • target: string | Element

Returns Promise<boolean>

Shows the tooltip at a point or against a rectangle, in viewport coordinates, for example at the clientX and clientY of a pointer event. Without width and height, the rectangle is a point.

showAt(rect: TooltipRect): Promise<boolean>

Parameters

Returns Promise<boolean>

Toggles the tooltip between shown/hidden state.

toggle(): Promise<boolean>

Returns Promise<boolean>

Emitted after the tooltip closes on a user interaction and is no longer visible.

onClosed(args: CustomEvent<void>): void

Parameters

Returns void

Emitted before the tooltip closes on a user interaction. Can be canceled to prevent closing. Not emitted for the

onClosing(args: CustomEvent<void>): void

Parameters

Returns void

Emitted after the tooltip opens on a user interaction and is visible.

onOpened(args: CustomEvent<void>): void

Parameters

Returns void

Emitted before the tooltip opens on a user interaction. Can be canceled to prevent opening.

onOpening(args: CustomEvent<void>): void

Parameters

Returns void