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

PropertyTypeDescription
appAppThe Obsidian app instance.
isOpenbooleanWhether the suggestion popup is currently open and visible.
scopeScopeThe scope for the keymaps.
suggestElHTMLDivElementSuggestion container element.
suggestInnerElHTMLElementThe inner element holding the rendered suggestions.
suggestionsSuggestModalChooser<T, this>Handles selection and rendering of the suggestions.
winnull | WindowThe window the suggestion popover is shown in, or null while closed.

Methods

MethodReturnsDescription
attachDom()voidAttaches the suggestion popover to the document with an open animation.
autoDestroy()voidAutomatically destroy the popover when its associated element is removed.
close()voidCloses the popover.
detachDom()voidDetaches the suggestion popover from the document.
onEscapeKey()voidHandle the escape key to close the popover.
onHistoryBack()voidCalled when the user navigates back in the history.
(Inherited from HistoryHandler)
onHistoryForward()voidCalled when the user navigates forward in the history.
(Inherited from HistoryHandler)
onSelectedChange(value, evt?)voidCalled after every selection change, including the programmatic one that follows SuggestModalChooser.setSuggestions.
open()voidOpens the popover.
renderSuggestion(value, el)voidRender the suggestion.
reposition(rect, textDirection?)voidReposition the popover relative to the given bounding rectangle.
selectSuggestion(value, evt)voidSelect the suggestion.
setAutoDestroy(el)voidSet the element that triggers automatic destruction of the popover when removed.

Links to this page: