Nested categories
Stay organized with collections
Save and categorize content based on your preferences.
Categories may be nested within other categories. Here are two top-level
categories ('Core' and 'Custom'), the second of which contains two sub-categories,
each of which contain blocks:
Note that it is possible for a category to contain both sub-categories and
blocks. In the above example, 'Custom' has two sub-categories ('Move' and
'Turn'), as well as a block of its own ('start').
JSON
{
"kind": "categoryToolbox",
"contents": [
{
"kind": "category",
"name": "Core",
"contents": [
{
"kind": "block",
"type": "controls_if"
},
{
"kind": "block",
"type": "logic_compare"
},
]
},
{
"kind": "category",
"name": "Custom",
"contents": [
{
"kind": "block",
"type": "start"
},
{
"kind": "category",
"name": "Move",
"contents": [
{
"kind": "block",
"type": "move_forward"
}
]
},
{
"kind": "category",
"name": "Turn",
"contents": [
{
"kind": "block",
"type": "turn_left"
}
]
}
]
}
]
}
XML
<xml id="toolbox" style="display: none">
<category name="Core">
<block type="controls_if"></block>
<block type="logic_compare"></block>
</category>
<category name="Custom">
<block type="start"></block>
<category name="Move">
<block type="move_forward"></block>
</category>
<category name="Turn">
<block type="turn_left"></block>
</category>
</category>
</xml>
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-03-20 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-03-20 UTC."],[],[],null,["# Nested categories\n\nCategories may be nested within other categories. Here are two top-level\ncategories ('Core' and 'Custom'), the second of which contains two sub-categories,\neach of which contain blocks:\n\nNote that it is possible for a category to contain both sub-categories *and*\nblocks. In the above example, 'Custom' has two sub-categories ('Move' and\n'Turn'), as well as a block of its own ('start'). \n\n### JSON\n\n {\n \"kind\": \"categoryToolbox\",\n \"contents\": [\n {\n \"kind\": \"category\",\n \"name\": \"Core\",\n \"contents\": [\n {\n \"kind\": \"block\",\n \"type\": \"controls_if\"\n },\n {\n \"kind\": \"block\",\n \"type\": \"logic_compare\"\n },\n ]\n },\n {\n \"kind\": \"category\",\n \"name\": \"Custom\",\n \"contents\": [\n {\n \"kind\": \"block\",\n \"type\": \"start\"\n },\n {\n \"kind\": \"category\",\n \"name\": \"Move\",\n \"contents\": [\n {\n \"kind\": \"block\",\n \"type\": \"move_forward\"\n }\n ]\n },\n {\n \"kind\": \"category\",\n \"name\": \"Turn\",\n \"contents\": [\n {\n \"kind\": \"block\",\n \"type\": \"turn_left\"\n }\n ]\n }\n ]\n }\n ]\n }\n\n### XML\n\n \u003cxml id=\"toolbox\" style=\"display: none\"\u003e\n \u003ccategory name=\"Core\"\u003e\n \u003cblock type=\"controls_if\"\u003e\u003c/block\u003e\n \u003cblock type=\"logic_compare\"\u003e\u003c/block\u003e\n \u003c/category\u003e\n \u003ccategory name=\"Custom\"\u003e\n \u003cblock type=\"start\"\u003e\u003c/block\u003e\n \u003ccategory name=\"Move\"\u003e\n \u003cblock type=\"move_forward\"\u003e\u003c/block\u003e\n \u003c/category\u003e\n \u003ccategory name=\"Turn\"\u003e\n \u003cblock type=\"turn_left\"\u003e\u003c/block\u003e\n \u003c/category\u003e\n \u003c/category\u003e\n \u003c/xml\u003e"]]