diff --git a/custom-nodes/javascript_examples.mdx b/custom-nodes/javascript_examples.mdx index 62461e6c..9d677cd0 100644 --- a/custom-nodes/javascript_examples.mdx +++ b/custom-nodes/javascript_examples.mdx @@ -133,3 +133,29 @@ async nodeCreated(node) { } } ``` + +## Customizing the UI + +### Add a sidebar tab and panel + +You can use `app.extensionManager.registerTab` to add a custom sidebar panel for your extension +- [Icons list](https://primevue.org/icons/#list) + +```javascript +import { app } from "../../scripts/app.js"; + +app.extensionManager.registerSidebarTab({ + id: "my.extension.panel", + icon: "pi pi-money-bill", // icon class, see link above + title: "Panel Title", + tooltip: "This a custom panel", // displayed on mouse over the tab + type: "custom", + render: async (panelDiv) => { + // render custom content by adding your custom HTML to the panelDiv + console.log("rendering custom panel", panelDiv) + let h1 = document.createElement("h1") + h1.innerHTML = "I'm a custom panel!" + panelDiv.appendChild(h1) + }, +}) +``` \ No newline at end of file