Simulink® Context Menu Filter
R2026bYou can disable context menu widget actions and hide widgets. When you disable an action, the widgets that take the action remain visible but are dimmed and non-interactive. When you hide a widget, the context menu no longer displays it. You can hide specific widgets, or you can hide all widgets that take certain actions.
To disable widget actions or hide widgets, you define a filter in a JSON file. This page describes how to write the JSON declarations that define the filter.
Implement your customization with these steps.
Decide which actions to disable and which widgets to hide. To learn about the widgets the context menu contains, see Simulink Context Menu Architecture.
Create a folder named
resources. In the folder, create a JSON-formatted file namedextensions.json. You can create more than oneextensions.jsonfile, as long as they are in differentresourcesfolders.Add this template to the file.
{ "mw.studio.filters.<Filter Name>": { "type": "Filter", "elements": [ <widget or action 1>, <widget or action 2>, <widget or action 3>, ... <widget or action N> ], "hideActions": <true or false>, "when": "<condition>" } }To learn how to fill in this template, see the Examples and Properties on this page.
Code formatting mistakes such as missing brackets or incorrect line indentation can prevent your customizations from rendering as expected. To avoid formatting mistakes, consider writing the declarations in an integrated development environment (IDE) equipped to help you format code, for example, Visual Studio® Code.
Enable your customizations. Add the parent folder of the
resourcesfolder to the MATLAB® path using theaddpathfunction. Alternatively, right-click the folder in the Files panel and select Add to Path > Selected Folder(s) and Subfolders. Then, refresh the customizations using theslReloadStudioConfigfunction.
For more information about using extension points, see Customize Simulink Context Menu Using Extension Points.
Examples
Properties
Version History
Introduced in R2026b