blockly > ToolboxItem

ToolboxItem class

Class for an item in the toolbox.

Signature:

export declare class ToolboxItem implements IToolboxItem 

Implements: IToolboxItem

Constructors

Constructor Modifiers Description
(constructor)(toolboxItemDef, parentToolbox, opt_parent) Constructs a new instance of the ToolboxItem class

Properties

Property Modifiers Type Description
id_ protected string
level_ protected number
parent_ protected ICollapsibleToolboxItem | null
parentToolbox_

protected

readonly

IToolbox The toolbox this category belongs to.
toolboxItemDef_ protected toolbox.ToolboxItemInfo | null
workspace_ protected WorkspaceSvg

Methods

Method Modifiers Description
dispose() Dispose of this toolbox item. No-op by default.
getClickTarget() Gets the HTML element that is clickable. The parent toolbox element receives clicks. The parent toolbox will add an ID to this element so it can pass the onClick event to the correct toolboxItem.
getDiv() Gets the div for the toolbox item.
getId() Gets a unique identifier for this toolbox item.
getParent() Gets the parent if the toolbox item is nested.
init() Initializes the toolbox item. This includes creating the DOM and updating the state of any items based on the info object.
isCollapsible() Whether the toolbox item is collapsible.
isSelectable() Whether the toolbox item is selectable.
setVisible_(_isVisible) Sets whether the category is visible or not. For a category to be visible its parent category must also be expanded.