Skip to main content

Home > blockly > BlockSvg > setDisabledReason

BlockSvg.setDisabledReason() method

Add or remove a reason why the block might be disabled. If a block has any reasons to be disabled, then the block itself will be considered disabled. A block could be disabled for multiple independent reasons simultaneously, such as when the user manually disables it, or the block is invalid.

Signature:

setDisabledReason(disabled: boolean, reason: string): void;

Parameters

ParameterTypeDescription
disabledbooleanIf true, then the block should be considered disabled for at least the provided reason, otherwise the block is no longer disabled for that reason.
reasonstringA language-neutral identifier for a reason why the block could be disabled. Call this method again with the same identifier to update whether the block is currently disabled for this reason.

Returns:

void