HoverPopover
Official
A hover popover.
Import:
import { HoverPopover } from 'obsidian';Signature:
export class HoverPopover extends ComponentExtends: 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
| Property | Type | Description | |
|---|---|---|---|
| _children | Component[] | Child Components attached to current component, will be unloaded on unloading parent component. (Inherited from Component) | |
| _events | EventRef[] | Events that are attached to the current component, will be detached on unloading parent component. (Inherited from Component) | |
| _loaded | boolean | Whether the component and its children are loaded. (Inherited from Component) | |
| hoverEl | HTMLElement | The HTML element representation of the hover popover. | |
| isFocused | boolean | Whether the popover is currently focused. | |
| onHover | boolean | Whether the pointer is currently over the popover. | |
| onTarget | boolean | Whether the pointer is currently over the target element. | |
| parent | HoverParent | The parent that owns this popover. | |
| state | PopoverState | The state of the hover popover. | |
| staticPos | null | Point | The fixed position of the popover, or null to position relative to the target. | |
| targetEl | HTMLElement | null | The target element the popover is anchored to, or null. | |
| timer | number | The active show/hide timer handle. | |
| waitTime | number | The delay before showing or hiding, in milliseconds. |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| addChild(component) | T | Adds a child component, loading it if this component is loaded. (Inherited from Component) | |
| detect(el) | void | Updates the hover/target flags based on the element under the pointer. | |
| hide() | void | Hides and unloads the popover. | |
| load() | void | Load this component and its children. (Inherited from Component) | |
| onHide() | void | Called when the popover is hidden. | |
| onload() | void | Override this to load your component. (Inherited from Component) | |
| onMouseIn(evt) | void | Handles the pointer entering the target. | |
| onMouseOut(evt) | void | Handles the pointer leaving the target. | |
| onShow() | void | Called when the popover is shown. | |
| onunload() | void | Override this to unload your component (Inherited from Component) | |
| position() | void | Positions the popover relative to its target or static position. | |
| register(cb) | void | Registers a callback to be called when unloading. (Inherited from Component) | |
| registerDomEvent(el, type, callback, options?) | void | Registers a DOM event to be detached when unloading. (Inherited from Component) | |
| registerDomEvent(el, type, callback, options?) | void | Registers a DOM event to be detached when unloading (Inherited from Component) | |
| registerDomEvent(el, type, callback, options?) | void | Registers a DOM event to be detached when unloading (Inherited from Component) | |
| registerEvent(eventRef) | void | Registers an event to be detached when unloading. (Inherited from Component) | |
| registerInterval(id) | number | Registers 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) | void | Register a scope keymap event handler to be removed on unload. (Inherited from Component) | |
| removeChild(component) | T | Removes a child component, unloading it. (Inherited from Component) | |
| setIsFocused(isFocused) | void | Sets whether the popover is focused. | |
| shouldShow() | boolean | Whether the popover (or any child) should currently be shown. | |
| shouldShowChild() | boolean | Whether any child popover should currently be shown. | |
| shouldShowSelf() | boolean | Whether this popover itself should currently be shown. | |
| show() | void | Shows the popover. | |
| transition() | void | Transitions the popover between shown and hidden based on HoverPopover.shouldShow. | |
| unload() | void | Override this to unload your component. (Inherited from Component) | |
| watchResize() | void | Start observing the popover element for size changes. |
Links to this page:
- CanvasView
- DatePropertyWidgetComponent
- DatePropertyWidgetComponentBase
- DatetimePropertyWidgetComponent
- DomEventsHandlersInfo
- EmbeddedEditorView
- getHoverPopoverConstructor
- HoverParent
- MarkdownEditView
- MarkdownFileInfo
- MarkdownPreviewView
- MarkdownRenderer
- MarkdownView
- MetadataEditor
- RenderContext
- TypedWorkspaceLeaf
- WidgetEditorView
- WorkspaceLeaf