Stay organized with collections
Save and categorize content based on your preferences.
blockly > IIcon
IIcon interface
Signature:
export interface IIcon extends IFocusableNode
Extends: IFocusableNode
Methods
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-16 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eIIcon\u003c/code\u003e interface defines the structure and behavior of icons used within Blockly blocks.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods for managing the icon's appearance, including color, size, and visibility based on block state.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eIIcon\u003c/code\u003e includes methods for handling user interactions, such as clicks and location changes.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can customize icon behavior by implementing these methods to create interactive elements within blocks.\u003c/p\u003e\n"]]],[],null,["[blockly](./blockly.md) \\\u003e [IIcon](./blockly.iicon_interface.md)\n\nIIcon interface\n---------------\n\n**Signature:** \n\n export interface IIcon extends IFocusableNode \n\n**Extends:** [IFocusableNode](./blockly.ifocusablenode_interface.md)\n\nMethods\n-------\n\n| Method | Description |\n|---------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [applyColour()](./blockly.iicon_interface.applycolour_1_methodsignature.md) | Updates the icon's color when the block's color changes.. |\n| [dispose()](./blockly.iicon_interface.dispose_1_methodsignature.md) | Disposes of any elements of the icon. |\n| [getSize()](./blockly.iicon_interface.getsize_1_methodsignature.md) | |\n| [getType()](./blockly.iicon_interface.gettype_1_methodsignature.md) | |\n| [getWeight()](./blockly.iicon_interface.getweight_1_methodsignature.md) | |\n| [hideForInsertionMarker()](./blockly.iicon_interface.hideforinsertionmarker_1_methodsignature.md) | Hides the icon when it is part of an insertion marker. |\n| [initView(pointerdownListener)](./blockly.iicon_interface.initview_1_methodsignature.md) | Creates the SVG elements for the icon that will live on the block. |\n| [isClickableInFlyout(autoClosingFlyout)?](./blockly.iicon_interface.isclickableinflyout_1_methodsignature.md) | *(Optional)* Check whether the icon should be clickable while the block is in a flyout. If this function is not defined, the icon will be clickable in all flyouts. |\n| [isShownWhenCollapsed()](./blockly.iicon_interface.isshownwhencollapsed_1_methodsignature.md) | |\n| [onClick()](./blockly.iicon_interface.onclick_1_methodsignature.md) | Notifies the icon that it has been clicked. |\n| [onLocationChange(blockOrigin)](./blockly.iicon_interface.onlocationchange_1_methodsignature.md) | Notifies the icon that it has changed locations. |\n| [setOffsetInBlock(offset)](./blockly.iicon_interface.setoffsetinblock_1_methodsignature.md) | Notifies the icon where it is relative to its block's top-start, in workspace units. |\n| [updateCollapsed()](./blockly.iicon_interface.updatecollapsed_1_methodsignature.md) | Updates the icon's collapsed-ness/view when the block's collapsed-ness changes. |\n| [updateEditable()](./blockly.iicon_interface.updateeditable_1_methodsignature.md) | Updates the icon's editability when the block's editability changes. |"]]