Skip to content

SuggestModalChooser<T, TModal>

Unofficial

Chooser component for a suggest modal, managing suggestion selection and navigation.

Import:

import type { SuggestModalChooser } from '@obsidian-typings/obsidian-public-latest';

Signature:

export interface SuggestModalChooser<T, TModal>

Properties

Property Type Description
chooser TModal Reference to the owning modal.
containerEl HTMLDivElement Container element for the suggestion list.
numVisibleItems number Number of suggestions visible at once.
rowHeight number Height of each suggestion row in pixels.
selectedItem number Index of the currently selected suggestion.
suggestions HTMLDivElement[] DOM elements for each suggestion row.
values null | T[] Current suggestion values, or null if none.

Methods

Method Returns Description
addMessage(text) void Display a message in the suggestion list.
addSuggestion(value) void Add a suggestion value to the list.
forceSetSelectedItem(index, evt) void Set the selected item by index, forcing scroll into view.
moveDown(evt) false | void Move selection to the next suggestion.
moveUp(evt) false | void Move selection to the previous suggestion.
onSuggestionClick(evt, suggestion) void Handle click on a suggestion element.
onSuggestionMouseover(evt, suggestion) void Handle mouseover on a suggestion element.
pageDown(evt) false | void Move selection down by one page of visible items.
pageUp(evt) false | void Move selection up by one page of visible items.
setSelectedItem(index, evt) void Set the selected item by index.
setSuggestions(values) void Replace all suggestions with new values.
useSelectedItem(evt) void Accept the currently selected suggestion.

Links to this page: