ModalCommandBuilder
Builds a modal’s control strip from keyboard commands, interactive checkboxes, and dropdowns, then applies them to a modal via ModalCommandBuilder.build.
Import:
import { ModalCommandBuilder } from 'obsidian-dev-utils/obsidian/modals/modal-command-builder';Signature:
export class ModalCommandBuilderMethods
| Method | Returns | Description |
|---|---|---|
| addCheckbox(command) | this | Adds an interactive checkbox to the control strip, bound to a modifier+key shortcut that toggles it. |
| addDropDown(command) | this | Adds a dropdown to the control strip, bound to a modifier+key shortcut that cycles through its options. |
| addKeyboardCommand(command) | this | Adds a keyboard command to the control strip. When KeyboardCommand.onKey is provided, its handler is registered with the modal scope; otherwise the command is a hint only. |
| build(target, options?) | ModalCommands | Applies the accumulated commands to a modal. Always registers the essential navigation/action key handlers; only renders the control strip and registers the option-toggle shortcuts when ModalCommandBuilderBuildOptions.shouldShowInstructions is true. |
Links to this page: