Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions custom-nodes/javascript_examples.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,34 @@ async nodeCreated(node) {
}
}
```

## Customizing the UI

### Add a custom menu in the top bar

You can add `commands` to your extension and add them to the top bar menu using `menuCommands`
- [MenuCommandGroup definition](https://github.com/Comfy-Org/ComfyUI_frontend/blob/main/src/types/comfy.ts)
- [ComfyCommand definition](https://github.com/Comfy-Org/ComfyUI_frontend/blob/main/src/stores/commandStore.ts)

```javascript
import { api } from "../../scripts/api.js";

app.registerExtension({
name: "example.extension.commands",
commands: [ // list of ComfyCommand
{
id: "my.custom.command", // command id
label: "My Custom Command",
function: () => {
console.log("executed custom command")
},
},
],
menuCommands: [ // list of MenuCommandGroup
{
path: ["Custom", "Commands"],
commands: ["my.custom.command"], // list of command ids
},
],
})
```