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.
- Element
-
igc-tooltip
- 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.
Properties
Section titled "Properties"Optional anchor
Section titled "anchor"An element instance or an IDREF to use as the anchor for the tooltip.
anchor: string | Element = undefined Defined in src/components/tooltip/tooltip.ts:253
Remarks
An IDREF must point to an element in the DOM root of the tooltip. For an element in another root, pass the element reference instead.
hideDelay
Section titled "hideDelay"The time in milliseconds before a hide trigger closes the tooltip. A negative value is the same as 0.
hideDelay: number = 300 Defined in src/components/tooltip/tooltip.ts:307
message
Section titled "message"The plain-text content of the tooltip. Slotted content replaces it.
message: string = '' Defined in src/components/tooltip/tooltip.ts:315
offset
Section titled "offset"The offset of the tooltip from the anchor in pixels.
offset: number = 6 Defined in src/components/tooltip/tooltip.ts:209
placement
Section titled "placement"Where to place the tooltip relative to its anchor element.
placement: PopoverPlacement = 'bottom' Defined in src/components/tooltip/tooltip.ts:218
scrollStrategy
Section titled "scrollStrategy"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 = 'hide' Defined in src/components/tooltip/tooltip.ts:233
showDelay
Section titled "showDelay"The time in milliseconds before a show trigger opens the tooltip. A negative value is the same as 0.
showDelay: number = 200 Defined in src/components/tooltip/tooltip.ts:296
sticky
Section titled "sticky"Whether the tooltip stays visible until the user closes it with the close button or the Escape key.
sticky: boolean = false Defined in src/components/tooltip/tooltip.ts:324
withArrow
Section titled "withArrow"Whether to render an arrow indicator for the tooltip.
withArrow: boolean = false Defined in src/components/tooltip/tooltip.ts:200
tagName
Section titled "tagName"The tagName read-only property of the Element interface returns the tag name of the element on which it's called.
tagName: "igc-tooltip" = 'igc-tooltip' Defined in src/components/tooltip/tooltip.ts:83
Accessors
Section titled "Accessors"hideTriggers
Section titled "hideTriggers"get hideTriggers(): any Defined in src/components/tooltip/tooltip.ts:279
The anchor events that hide the tooltip. A list of event names, separated by commas or spaces.
set hideTriggers(value: string): void Defined in src/components/tooltip/tooltip.ts:279
Parameters
- value:
string
Returns void
get open(): any Defined in src/components/tooltip/tooltip.ts:180
Whether the tooltip is showing.
set open(value: boolean): void Defined in src/components/tooltip/tooltip.ts:180
Parameters
- value:
boolean
Returns void
showTriggers
Section titled "showTriggers"get showTriggers(): any Defined in src/components/tooltip/tooltip.ts:263
The anchor events that show the tooltip. A list of event names, separated by commas or spaces.
set showTriggers(value: string): void Defined in src/components/tooltip/tooltip.ts:263
Parameters
- value:
string
Returns void
Methods
Section titled "Methods"Hides the tooltip if not already hidden.
hide(): Promise<boolean> Defined in src/components/tooltip/tooltip.ts:550
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> Defined in src/components/tooltip/tooltip.ts:506
Parameters
- target:
string | Element
Returns Promise<boolean>
showAt
Section titled "showAt"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> Defined in src/components/tooltip/tooltip.ts:531
Parameters
- rect:
TooltipRect
Returns Promise<boolean>
toggle
Section titled "toggle"Toggles the tooltip between shown/hidden state.
toggle(): Promise<boolean> Defined in src/components/tooltip/tooltip.ts:560