Skip to content

DropDownCommand

A dropdown command shown in a modal’s control strip and bound to a modifier+key shortcut that cycles through its options.

Supported in ModalCommandsRenderMode.Instructions mode only.

Import:

import type { DropDownCommand } from '@mnaoumov/obsidian-lib/modals/modal-command-builder';

Signature:

export interface DropDownCommand extends CommandBase

Extends: CommandBase

Properties

PropertyTypeDescription
checkIsAvailable?() => booleanWhether the control can be used right now. When it returns false the control is rendered **disabled rather than removed**, so the strip does not reflow under the pointer as modes change — which on a phone means a mis-tap.

Re-read by ModalCommands.refresh. When omitted, the builder never touches the control's disabled state, leaving whatever CheckboxCommand.onInit / DropDownCommand.onInit set.
(Inherited from CommandBase)
keystringThe key that activates the command.
(Inherited from CommandBase)
modifiers?Modifier[]The modifiers combined with CommandBase.key. When omitted, no modifiers are required.
(Inherited from CommandBase)
onChange(value: string) => voidCalled when the dropdown value changes.
onInit(dropdownComponent: DropdownComponent) => voidCalled once with the created dropdown component, to initialize its options and state.
purposestringThe human-readable description shown next to the control.
(Inherited from CommandBase)