Skip to main content

Define a category toolbox

A category toolbox has multiple sets of blocks that are arranged into different categories.

A category toolbox with Control and Logic categories. The Logic category is
open and the flyout toolbox contains comparison, and-or, and true-false
blocks.

To create a category toolbox, pass JSON or XML describing the toolbox to the toolbox property of the configuration options.

var toolbox = {
"kind": "categoryToolbox",
"contents": [
{
"kind": "category",
"name": "Control",
"contents": [
{
"kind": "block",
"type": "controls_if"
},
]
},
{
"kind": "category",
"name": "Logic",
"contents": [
{
"kind": "block",
"type": "logic_compare"
},
{
"kind": "block",
"type": "logic_operation"
},
{
"kind": "block",
"type": "logic_boolean"
}
]
}
]
};
var workspace = Blockly.inject('blocklyDiv', {toolbox: toolbox});