Disable, hide, or expand categories
Stay organized with collections
Save and categorize content based on your preferences.
You can disable, hide, or expand categories.
Disable categories
A disabled category will not allow a user to open the category and it will be
skipped during keyboard navigation.
var category = toolbox.getToolboxItems()[0];
category.setDisabled('true');
When a category is disabled, a 'disabled'
property is added to the DOM
element, which allows you to control the look of a disabled category.
.blocklyToolboxCategoryContainer[disabled="true"] {
opacity: .5;
}
Hide categories
A hidden category will not be shown as part of the toolbox.
JSON
{
"kind": "category",
"name": "...",
"hidden": "true",
}
XML
<category name="..." hidden="true"></category>
Hidden categories can later be shown via JavaScript.
var category = toolbox.getToolboxItems()[0];
category.hide();
// etc...
category.show();
Expand categories
This only applies to categories which contain other nested
categories.
An expanded category will show you its sub categories. By default, nested
categories are collapsed, and need to be clicked to be expanded.
JSON
{
"kind": "category",
"name": "...",
"expanded": "true",
}
XML
<category name="..." expanded="true"></category>
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-08-14 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-08-14 UTC."],[],[],null,["# Disable, hide, or expand categories\n\nYou can disable, hide, or expand categories.\n\nDisable categories\n------------------\n\nA disabled category will not allow a user to open the category and it will be\nskipped during keyboard navigation. \n\n var category = toolbox.getToolboxItems()[0];\n category.setDisabled('true');\n\nWhen a category is disabled, a `'disabled'` property is added to the DOM\nelement, which allows you to control the look of a disabled category. \n\n .blocklyToolboxCategoryContainer[disabled=\"true\"] {\n opacity: .5;\n }\n\nHide categories\n---------------\n\nA hidden category will not be shown as part of the toolbox. \n\n### JSON\n\n {\n \"kind\": \"category\",\n \"name\": \"...\",\n \"hidden\": \"true\",\n }\n\n### XML\n\n \u003ccategory name=\"...\" hidden=\"true\"\u003e\u003c/category\u003e\n\nHidden categories can later be shown via JavaScript. \n\n var category = toolbox.getToolboxItems()[0];\n category.hide();\n // etc...\n category.show();\n\nExpand categories\n-----------------\n\nThis only applies to categories which contain other [nested\ncategories](/blockly/guides/configure/web/toolboxes/nested).\n\nAn expanded category will show you its sub categories. By default, nested\ncategories are collapsed, and need to be clicked to be expanded. \n\n### JSON\n\n {\n \"kind\": \"category\",\n \"name\": \"...\",\n \"expanded\": \"true\",\n }\n\n### XML\n\n \u003ccategory name=\"...\" expanded=\"true\"\u003e\u003c/category\u003e"]]