blockly > Block > setDisabledReason

Block.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.


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


Parameter Type Description
disabled boolean If true, then the block should be considered disabled for at least the provided reason, otherwise the block is no longer disabled for that reason.
reason string A 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.