Skip to content

SuggestModalCommandBuilder

Builds a SuggestModal’s instruction bar from keyboard commands, interactive checkboxes, and dropdowns, then applies them to a modal via SuggestModalCommandBuilder.build.

Import:

import { SuggestModalCommandBuilder } from 'obsidian-dev-utils/obsidian/modals/suggest-modal-command-builder';

Signature:

export class SuggestModalCommandBuilder

Methods

MethodReturnsDescription
addCheckbox(command)thisAdds an interactive checkbox to the instruction bar, bound to a modifier+key shortcut that toggles it.
addDropDown(command)thisAdds a dropdown to the instruction bar, bound to a modifier+key shortcut that cycles through its options.
addKeyboardCommand(command)thisAdds a keyboard command to the instruction bar. When KeyboardCommand.onKey is provided, its handler is registered with the modal scope; otherwise the command is a hint only.
build(modal, options?)voidApplies the accumulated commands to a modal. Always registers the essential navigation/action key handlers; only renders the instruction UI and registers the option-toggle shortcuts when SuggestModalCommandBuilderBuildOptions.shouldShowInstructions is true.