Skip to content

AbstractInputSuggest<T>

Official

Attach to an <input> element or a <div contentEditable> to add type-ahead support.

Import:

import { AbstractInputSuggest } from 'obsidian';

Signature:

export class AbstractInputSuggest<T> extends PopoverSuggest<T>

Extends: PopoverSuggest<T>

Constructor

new AbstractInputSuggest(app: App, textInputEl: HTMLDivElement | HTMLInputElement)

Constructor.

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

Properties

PropertyTypeDescription
appAppThe Obsidian app instance.
(Inherited from PopoverSuggest)
isOpenbooleanWhether the suggestion popup is currently open and visible.
(Inherited from PopoverSuggest)
lastRectDOMRectThe last bounding rectangle used for positioning the suggestion popover.
limitnumberLimit to the number of elements rendered at once. Set to 0 to disable.
scopeScopeThe scope for the keymaps.
(Inherited from PopoverSuggest)
suggestElHTMLDivElementSuggestion container element.
(Inherited from PopoverSuggest)
suggestInnerElHTMLElementThe inner element holding the rendered suggestions.
(Inherited from PopoverSuggest)
suggestionsSuggestModalChooser<T, this>Handles selection and rendering of the suggestions.
(Inherited from PopoverSuggest)
textInputElHTMLDivElement | HTMLInputElementThe text input element this suggest is attached to.
winnull | WindowThe window the suggestion popover is shown in, or null while closed.
(Inherited from PopoverSuggest)

Methods

MethodReturnsDescription
attachDom()voidAttaches the suggestion popover to the document with an open animation.
(Inherited from PopoverSuggest)
autoDestroy()voidAutomatically destroy the popover when its associated element is removed.
(Inherited from PopoverSuggest)
autoReposition()voidAutomatically reposition the suggestion popover based on the input element.
close()voidCloses the popover.
(Inherited from PopoverSuggest)
detachDom()voidDetaches the suggestion popover from the document.
(Inherited from PopoverSuggest)
getSuggestions(query)Promise<T[]> | T[]Gets the suggestions for the input element.
getValue()stringGets the value from the input element.
onEscapeKey()voidHandle the escape key to close the popover.
(Inherited from PopoverSuggest)
onInputChange()voidHandle changes to the input element's value.
onInputFocus()voidHandle the input element receiving focus.
onSelect(callback)thisRegisters a callback to handle when a suggestion is selected by the user.
onSelectedChange(value, evt?)voidCalled after every selection change, including the programmatic one that follows SuggestModalChooser.setSuggestions.
(Inherited from PopoverSuggest)
open()voidOpens the popover.
(Inherited from PopoverSuggest)
renderSuggestion(value, el)voidRender the suggestion.
(Inherited from PopoverSuggest)
reposition(rect, textDirection?)voidReposition the popover relative to the given bounding rectangle.
(Inherited from PopoverSuggest)
selectCb(value, evt)unknownCallback for selecting a suggestion.
selectSuggestion(value, evt)voidSelect a suggestion.
setAutoDestroy(el)voidSet the element that triggers automatic destruction of the popover when removed.
(Inherited from PopoverSuggest)
setValue(value)voidSets the value into the input element.
showSuggestions(suggestions)voidDisplay the given values as suggestions, truncated to limit, or close the popover if there are none.