Skip to content
Merged
Show file tree
Hide file tree
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
36 changes: 21 additions & 15 deletions custom-nodes/js/javascript_about_panel_badges.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ app.registerExtension({
{
label: "Documentation",
url: "https://example.com/docs",
icon: "pi pi-file"
icon: "icon-[lucide--file]"
},
{
label: "GitHub",
url: "https://github.com/username/repo",
icon: "pi pi-github"
icon: "icon-[lucide--github]"
}
]
});
Expand All @@ -33,23 +33,29 @@ Each badge requires all of these properties:
{
label: string, // Text to display on the badge
url: string, // URL to open when badge is clicked
icon: string // Icon class (e.g., PrimeVue icon)
icon: string // Icon class (e.g., "icon-[lucide--github]")
}
```

## Icon Options

Badge icons use PrimeVue's icon set. Here are some commonly used icons:
Badge icons use [Lucide](https://lucide.dev/icons/) icon classes in the form
`icon-[lucide--<icon-name>]`. Here are some commonly used icons:

- Documentation: `pi pi-file` or `pi pi-book`
- GitHub: `pi pi-github`
- External link: `pi pi-external-link`
- Information: `pi pi-info-circle`
- Download: `pi pi-download`
- Website: `pi pi-globe`
- Discord: `pi pi-discord`
- Documentation: `icon-[lucide--file]` or `icon-[lucide--book-open]`
- GitHub: `icon-[lucide--github]`
- External link: `icon-[lucide--external-link]`
- Information: `icon-[lucide--info]`
- Download: `icon-[lucide--download]`
- Website: `icon-[lucide--globe]`

For a complete list of available icons, refer to the [PrimeVue Icons documentation](https://primevue.org/icons/).
The frontend generates these classes when it is built, so only the Lucide icons that
the frontend itself uses are available. If an icon does not render, pick another
icon, or define your own icon class in a stylesheet that your extension loads.

PrimeIcons classes such as `pi pi-file` still render for now, but they are being
phased out. Don't use them in new code. See [PrimeVue removal
migration](/custom-nodes/js/primevue-removal-migration).

## Example

Expand All @@ -60,17 +66,17 @@ app.registerExtension({
{
label: "Website",
url: "https://example.com",
icon: "pi pi-home"
icon: "icon-[lucide--globe]"
},
{
label: "Donate",
url: "https://example.com/donate",
icon: "pi pi-heart"
icon: "icon-[lucide--heart]"
},
{
label: "Documentation",
url: "https://example.com/docs",
icon: "pi pi-book"
icon: "icon-[lucide--book-open]"
}
]
});
Expand Down
26 changes: 16 additions & 10 deletions custom-nodes/js/javascript_selection_toolbox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ app.registerExtension({
{
id: "my-extension.duplicate-special",
label: "Duplicate Special",
icon: "pi pi-copy",
icon: "icon-[lucide--copy]",
function: (selectedItem) => {
// Your command logic here
console.log("Duplicating selected nodes with special behavior");
Expand Down Expand Up @@ -51,10 +51,16 @@ The `function` receives the selected item(s) as a parameter, allowing you to per

## Icon Options

Selection toolbox buttons support the same icon libraries as other UI elements:
Selection toolbox buttons use [Lucide](https://lucide.dev/icons/) icon classes in
the form `icon-[lucide--<icon-name>]` (e.g., `icon-[lucide--star]`).

- PrimeVue icons: `pi pi-[icon-name]` (e.g., `pi pi-star`)
- Material Design icons: `mdi mdi-[icon-name]` (e.g., `mdi mdi-content-copy`)
The frontend generates these classes when it is built, so only the Lucide icons that
the frontend itself uses are available. If an icon does not render, pick another
icon, or define your own icon class in a stylesheet that your extension loads.

PrimeIcons (`pi pi-*`) and Material Design Icons (`mdi mdi-*`) classes still
render for now, but they are being phased out. Don't use them in new code. See
[PrimeVue removal migration](/custom-nodes/js/primevue-removal-migration).

## Dynamic Command Visibility

Expand All @@ -67,15 +73,15 @@ app.registerExtension({
{
id: "my-ext.align-nodes",
label: "Align Nodes",
icon: "pi pi-align-left",
icon: "icon-[lucide--align-start-vertical]",
function: () => {
// Align multiple nodes
}
},
{
id: "my-ext.configure-single",
label: "Configure",
icon: "pi pi-cog",
icon: "icon-[lucide--settings]",
function: () => {
// Configure single node
}
Expand Down Expand Up @@ -109,7 +115,7 @@ app.registerExtension({
{
id: "my-ext.show-info",
label: "Show Selection Info",
icon: "pi pi-info-circle",
icon: "icon-[lucide--info]",
function: () => {
const selectedItems = app.canvas.selectedItems;

Expand Down Expand Up @@ -141,7 +147,7 @@ app.registerExtension({
{
id: "selection-tools.count",
label: "Count Selection",
icon: "pi pi-hashtag",
icon: "icon-[lucide--tag]",
function: () => {
const count = app.canvas.selectedItems?.size || 0;
app.extensionManager.toast.add({
Expand All @@ -155,7 +161,7 @@ app.registerExtension({
{
id: "selection-tools.copy-ids",
label: "Copy IDs",
icon: "pi pi-copy",
icon: "icon-[lucide--copy]",
function: () => {
const items = Array.from(app.canvas.selectedItems || []);
const ids = items.map(item => item.id).filter(id => id !== undefined);
Expand All @@ -174,7 +180,7 @@ app.registerExtension({
{
id: "selection-tools.log-types",
label: "Log Types",
icon: "pi pi-info-circle",
icon: "icon-[lucide--info]",
function: () => {
const items = Array.from(app.canvas.selectedItems || []);
const typeCount = {};
Expand Down
57 changes: 24 additions & 33 deletions custom-nodes/js/javascript_settings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@

### Extra configuration

The setting types are based on [PrimeVue](https://primevue.org/) components.
Props described in the PrimeVue documentation can be defined for ComfyUI
settings by adding them in an `attrs` field.
Each setting type renders a ComfyUI frontend form component. You can pass
extra props to that component in an `attrs` field. The props each type
supports are listed under [Types](#types).

For instance, this adds increment/decrement buttons to a number input:
For instance, this limits a number input to a range and step:

```javascript
{
Expand All @@ -96,7 +96,9 @@
type: "number",
defaultValue: 0,
attrs: {
showButtons: true,
min: 0,
max: 100,
step: 5,
},
onChange: (newVal, oldVal) => {
console.log(`Setting was changed from ${oldVal} to ${newVal}`);
Expand All @@ -105,15 +107,17 @@
```


If your extension passed PrimeVue props such as `showButtons`,
`maxFractionDigits`, `editable` or `filter`, see [PrimeVue removal
migration](/custom-nodes/js/primevue-removal-migration). The settings panel no
longer uses PrimeVue components, so those props have no effect.

## Types

### Boolean

This shows an on/off toggle.

Based on the [ToggleSwitch PrimeVue
component](https://primevue.org/toggleswitch/).

```javascript
{
id: "example.boolean",
Expand All @@ -130,8 +134,6 @@

This is freeform text.

Based on the [InputText PrimeVue component](https://primevue.org/inputtext/).

```javascript
{
id: "example.text",
Expand All @@ -148,10 +150,10 @@

This for entering numbers.

To allow decimal places, set the `maxFractionDigits` attribute to a number greater than zero.

Based on the [InputNumber PrimeVue
component](https://primevue.org/inputnumber/).
The input always shows increment and decrement buttons. Supported `attrs` are
`min`, `max`, `step` and `formatOptions`. `formatOptions` takes
[`Intl.NumberFormatOptions`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options),
so `maximumFractionDigits` controls how many decimal places are shown.

```javascript
{
Expand All @@ -160,8 +162,8 @@
type: "number",
defaultValue: 42,
attrs: {
showButtons: true,
maxFractionDigits: 1,
step: 0.1,
formatOptions: { maximumFractionDigits: 1 },
},
onChange: (newVal, oldVal) => {
console.log(`Setting was changed from ${oldVal} to ${newVal}`);
Expand All @@ -173,8 +175,7 @@

This lets the user enter a number directly or via a slider.

Based on the [Slider PrimeVue component](https://primevue.org/slider/). Ranges
are not supported.
Supported `attrs` are `min`, `max` and `step`. Ranges are not supported.

```javascript
{
Expand All @@ -201,11 +202,8 @@
and `value` fields. If you only provide a plain string, then it will be used
for both.

You can let the user enter freeform text by supplying the `editable: true`
attribute, or search by supplying the `filter: true` attribute.

Based on the [Select PrimeVue component](https://primevue.org/select/). Groups
are not supported.
You can let the user search the list by supplying the `searchable: true`
attribute. Groups and freeform text entry are not supported.

```javascript
{
Expand All @@ -218,8 +216,7 @@
"My second option",
],
attrs: {
editable: true,
filter: true,
searchable: true,
},
onChange: (newVal, oldVal) => {
console.log(`Setting was changed from ${oldVal} to ${newVal}`);
Expand All @@ -232,11 +229,8 @@
This lets the user select a color from a color picker or type in a hex
reference.

Note that the format requires six full hex digits - three digit shorthand does
not work.

Based on the [ColorPicker PrimeVue
component](https://primevue.org/colorpicker/).
Note that the format requires six full hex digits (or eight, with alpha). Three
digit shorthand does not work.

```javascript
{
Expand All @@ -257,9 +251,6 @@
The setting will be saved as a [data
URL](https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data).

Based on the [FileUpload PrimeVue
component](https://primevue.org/fileupload/).

```javascript
{
id: "example.image",
Expand Down Expand Up @@ -302,7 +293,7 @@
}
```

### Tooltips

Check warning on line 296 in custom-nodes/js/javascript_settings.mdx

View check run for this annotation

Mintlify / Mintlify Validation (dripart) - vale-spellcheck

custom-nodes/js/javascript_settings.mdx#L296

Did you really mean 'Tooltips'?

You can add extra contextual help with the `tooltip` field. This adds a small ℹ︎
icon after the field name that will show the help text when the user hovers
Expand Down
21 changes: 12 additions & 9 deletions custom-nodes/js/javascript_sidebar_tabs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Sidebar Tabs API allows extensions to add custom tabs to the sidebar of the
```javascript
app.extensionManager.registerSidebarTab({
id: "customSidebar",
icon: "pi pi-compass",
icon: "icon-[lucide--compass]",
title: "Custom Tab",
tooltip: "My Custom Sidebar Tab",
type: "custom",
Expand Down Expand Up @@ -39,13 +39,16 @@ The `render` function receives a DOM element where you should insert your tab's

## Icon Options

Sidebar tab icons can use various icon sets:
Sidebar tab icons use [Lucide](https://lucide.dev/icons/) icon classes in the form
`icon-[lucide--<icon-name>]` (e.g., `icon-[lucide--compass]`).

- PrimeVue icons: `pi pi-[icon-name]` (e.g., `pi pi-home`)
- Material Design icons: `mdi mdi-[icon-name]` (e.g., `mdi mdi-robot`)
- Font Awesome icons: `fa-[style] fa-[icon-name]` (e.g., `fa-solid fa-star`)
The frontend generates these classes when it is built, so only the Lucide icons that
the frontend itself uses are available. If an icon does not render, pick another
icon, or define your own icon class in a stylesheet that your extension loads.

Ensure the corresponding icon library is loaded before using these icons.
PrimeIcons (`pi pi-*`) and Material Design Icons (`mdi mdi-*`) classes still
render for now, but they are being phased out. Don't use them in new code. See
[PrimeVue removal migration](/custom-nodes/js/primevue-removal-migration).

## Stateful Tab Example

Expand All @@ -54,7 +57,7 @@ You can create tabs that maintain state:
```javascript
app.extensionManager.registerSidebarTab({
id: "statefulTab",
icon: "pi pi-list",
icon: "icon-[lucide--list]",
title: "Notes",
type: "custom",
render: (el) => {
Expand Down Expand Up @@ -97,7 +100,7 @@ import ReactDOM from "react-dom/client";
// Register sidebar tab with React content
app.extensionManager.registerSidebarTab({
id: "reactSidebar",
icon: "mdi mdi-react",
icon: "icon-[lucide--blocks]",
title: "React Tab",
type: "custom",
render: (el) => {
Expand Down Expand Up @@ -139,7 +142,7 @@ You can update sidebar content in response to graph changes:
```javascript
app.extensionManager.registerSidebarTab({
id: "dynamicSidebar",
icon: "pi pi-chart-line",
icon: "icon-[lucide--activity]",
title: "Stats",
type: "custom",
render: (el) => {
Expand Down
Loading
Loading