Skip to content

PopoverSuggest<T>

Official

Base class for adding a type-ahead popover.

Import:

import { PopoverSuggest } from 'obsidian';

Signature:

export class PopoverSuggest<T> implements ISuggestOwner<T>, HistoryHandler

Implements: ISuggestOwner<T>, HistoryHandler

Constructor

new PopoverSuggest(app: App, scope?: Scope | undefined)

Constructor.

To extract the constructor type, use ExtractConstructor<PopoverSuggest>.

Properties

Property Type Description
app App The Obsidian app instance.
isOpen boolean Whether the suggestion popup is currently open and visible.
scope Scope The scope for the keymaps.
suggestEl HTMLDivElement Suggestion container element.
suggestInnerEl HTMLElement The inner element holding the rendered suggestions.
suggestions SuggestionContainer<T> Handles selection and rendering of the suggestions.

Methods

Method Returns Description
attachDom() void Attaches the suggestion popover to the document with an open animation.
autoDestroy() void Automatically destroy the popover when its associated element is removed.
close() void Closes the popover.
detachDom() void Detaches the suggestion popover from the document.
onEscapeKey() void Handle the escape key to close the popover.
onHistoryBack() void Called when the user navigates back in the history.
(Inherited from HistoryHandler)
onHistoryForward() void Called when the user navigates forward in the history.
(Inherited from HistoryHandler)
open() void Opens the popover.
renderSuggestion(value, el) void Render the suggestion.
reposition(rect, textDirection?) void Reposition the popover relative to the given bounding rectangle.
selectSuggestion(value, evt) void Select the suggestion.
setAutoDestroy(el) void Set the element that triggers automatic destruction of the popover when removed.

Links to this page: