CheckboxCommand
A checkbox command shown in a modal’s control strip and bound to a modifier+key shortcut that toggles it.
Import:
import type { CheckboxCommand } from '@mnaoumov/obsidian-lib/modals/modal-command-builder';Signature:
export interface CheckboxCommand extends CommandBaseExtends: CommandBase
Properties
| Property | Type | Description |
|---|---|---|
| checkIsAvailable? | () => boolean | Whether 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) |
| key | string | The 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 | (isChecked: boolean) => void | Called when the checkbox value changes. |
| onInit | (checkboxEl: HTMLInputElement) => void | Called once with the created checkbox element, to initialize its state. In ModalCommandsRenderMode.Buttons mode the element is created but never appended — the button is a view of it — so the same initialization code serves both render modes. |
| purpose | string | The human-readable description shown next to the control. (Inherited from CommandBase) |
Links to this page: