The sidebar allows nodes and plugins to add custom tabs.
RED.sidebar
APIAdd a new tab to the sidebar.
The tab
definition is an object with the following properties:
Property | Description |
---|---|
id |
The unique id for this tab. |
label |
The text to display on the sidebar tab. This should not be too long. |
name |
The name of the tab displayed in the sidebar menu. |
iconClass |
The FontAwesome 4 class of the icon to use. For example, "fa fa-database" |
content |
The DOM element containing the content of the sidebar. |
toolbar |
(optional) A DOM element to display in the sidebar toolbar when this tab is active. |
enableOnEdit |
(optional) If set to true , this tab will be accessible whilst the edit dialog is open. Default: false . |
action |
(optional) The name of a registered action used to display this tab. This allows the user to assign a keyboard shortcut to switch to the tab. |
// The sidebar content
const content = $("<div>").css({"position":"relative","height":"100%"});
// (optional) A toolbar header for the sidebar
const header = $("<div>", {class:"red-ui-sidebar-header"}).appendTo(content);
RED.actions.add("my-custom-tab:show-custom-tab",function() {
RED.sidebar.show("my-custom-tab");
});
RED.sidebar.addTab({
id: "my-custom-tab",
label: "custom",
name: "My Custom Tab",
iconClass: "fa fa-database",
content: content,
action: "my-custom-tab:show-custom-tab"
});
Removes the tab, if it exists.
If a node adds a tab as part of its onpaletteadd
function, it must make sure it
calls this API to remove it as part of its onpaletteremove
function.
RED.sidebar.removeTab("my-custom-tab");
Show the given tab, if it exists, in the sidebar.
RED.sidebar.show("my-custom-tab")
Returns true
if the tab exists in the sidebar
let debugExists = RED.sidebar.containsTab('my-custom-tab');
Node-RED: Low-code programming for event-driven applications.
Copyright OpenJS Foundation and Node-RED contributors. All rights reserved. The OpenJS Foundation has registered trademarks and uses trademarks. For a list of trademarks of the OpenJS Foundation, please see our Trademark Policy and Trademark List. Trademarks and logos not indicated on the list of OpenJS Foundation trademarks are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.
The OpenJS Foundation | Terms of Use | Privacy Policy | OpenJS Foundation Bylaws | Trademark Policy | Trademark List | Cookie Policy