A suggest popover opened at an element or a rectangle, with no input behind it.
| Class |
Description |
| AnchoredSuggest |
A suggest popover opened at an anchor, for a picker that has no text input: a toolbar button, a context-menu action, a decoration in the editor. Obsidian’s AbstractInputSuggest opens only from an input and EditorSuggest only from the editor. This one is opened by AnchoredSuggest.openAt and closes on Escape, on a pointer-down outside it, and when its anchor element leaves the DOM. The keyboard works as in Obsidian’s own popovers: arrows move, Enter picks. ts class ColorSuggest extends AnchoredSuggest<string> \{ protected getSuggestions(): string[] \{ return ['red', 'green', 'blue']; \} public renderSuggestion(color: string, el: HTMLElement): void \{ el.setText(color); \} protected onChooseSuggestion(color: string): void \{ console.log(color); \} \} await new ColorSuggest(this.app).openAt(\{ anchor: buttonEl \}); It relies on PopoverSuggest members that obsidian.d.ts does not declare (suggestions, reposition, setAutoDestroy, suggestEl), read from Obsidian 1.15.0. |