Skip to content

KeyboardCommand

A keyboard command shown in a SuggestModal’s instruction bar and optionally bound to a modifier+key handler.

Import:

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

Signature:

export interface KeyboardCommand

Properties

PropertyTypeDescription
keystringThe key shown in the instruction bar (and registered with the modal scope when KeyboardCommand.onKey is provided).
modifiers?Modifier[]The modifiers combined with KeyboardCommand.key. When omitted, no modifiers are required.
purposestringThe human-readable description shown next to the key in the instruction bar.

Methods

MethodReturnsDescription
onKey(evt, ctx)booleanThe handler invoked when the shortcut is pressed. When omitted, the command is a hint only and no scope handler is registered.