Skip to content

HoverPopover

Official

A hover popover.

Import:

import { HoverPopover } from 'obsidian';

Signature:

export class HoverPopover extends Component

Extends: Component

Constructor

new HoverPopover(parent: HoverParent, targetEl: HTMLElement | null, waitTime?: number | undefined, staticPos?: Point | null | undefined)

Constructor.

To get the constructor instance, use getHoverPopoverConstructor from obsidian-typings/implementations.

Properties

PropertyTypeDescription
_childrenComponent[]Child Components attached to current component, will be unloaded on unloading parent component.
(Inherited from Component)
_eventsEventRef[]Events that are attached to the current component, will be detached on unloading parent component.
(Inherited from Component)
_loadedbooleanWhether the component and its children are loaded.
(Inherited from Component)
hoverElHTMLElementThe HTML element representation of the hover popover.
isFocusedbooleanWhether the popover is currently focused.
onHoverbooleanWhether the pointer is currently over the popover.
onTargetbooleanWhether the pointer is currently over the target element.
parentHoverParentThe parent that owns this popover.
statePopoverStateThe state of the hover popover.
staticPosnull | PointThe fixed position of the popover, or null to position relative to the target.
targetElHTMLElement | nullThe target element the popover is anchored to, or null.
timernumberThe active show/hide timer handle.
waitTimenumberThe delay before showing or hiding, in milliseconds.

Methods

MethodReturnsDescription
addChild(component)TAdds a child component, loading it if this component is loaded.
(Inherited from Component)
detect(el)voidUpdates the hover/target flags based on the element under the pointer.
hide()voidHides and unloads the popover.
load()voidLoad this component and its children.
(Inherited from Component)
onHide()voidCalled when the popover is hidden.
onload()voidOverride this to load your component.
(Inherited from Component)
onMouseIn(evt)voidHandles the pointer entering the target.
onMouseOut(evt)voidHandles the pointer leaving the target.
onShow()voidCalled when the popover is shown.
onunload()voidOverride this to unload your component
(Inherited from Component)
position()voidPositions the popover relative to its target or static position.
register(cb)voidRegisters a callback to be called when unloading.
(Inherited from Component)
registerDomEvent(el, type, callback, options?)voidRegisters a DOM event to be detached when unloading.
(Inherited from Component)
registerDomEvent(el, type, callback, options?)voidRegisters a DOM event to be detached when unloading
(Inherited from Component)
registerDomEvent(el, type, callback, options?)voidRegisters a DOM event to be detached when unloading
(Inherited from Component)
registerEvent(eventRef)voidRegisters an event to be detached when unloading.
(Inherited from Component)
registerInterval(id)numberRegisters an interval (from setInterval) to be cancelled when unloading. Use window.setInterval instead of setInterval to avoid TypeScript confusing between NodeJS vs Browser API
(Inherited from Component)
registerScopeEvent(keymapEventHandler)voidRegister a scope keymap event handler to be removed on unload.
(Inherited from Component)
removeChild(component)TRemoves a child component, unloading it.
(Inherited from Component)
setIsFocused(isFocused)voidSets whether the popover is focused.
shouldShow()booleanWhether the popover (or any child) should currently be shown.
shouldShowChild()booleanWhether any child popover should currently be shown.
shouldShowSelf()booleanWhether this popover itself should currently be shown.
show()voidShows the popover.
transition()voidTransitions the popover between shown and hidden based on HoverPopover.shouldShow.
unload()voidOverride this to unload your component.
(Inherited from Component)
watchResize()voidStart observing the popover element for size changes.

Links to this page: