ComfyUI Node

Virtual Group

Collapse a clump of nodes without deleting them — a canvas organizer, not a data node

By 2daadv·Created 6 months ago·Updated 21 days ago· 1
Virtual Group
      expandtrue
      node_ids
      node_names

      Big workflows turn into spaghetti, and one of the oldest tricks for taming them is collapsing a region of nodes into a little bar so you can see the rest of the graph. ComfyUI has a native way to do that per-node (right-click → collapse), but doing it for twenty nodes by hand is miserable. Virtual Group is the node that does it for you: you list which nodes you want to tuck away, flip a boolean, and the whole clump collapses. Flip it back and they expand.

      Read that carefully, because it's the whole honest scope: this node changes the canvas, not the computation. The README says it plainly - "実行時の動作は変えません" - it does not change runtime behavior. Collapsing a node does not bypass it, does not skip it, does not mute it. It's cosmetic. If you wanted a group mute, that's rgthree's Fast Groups Muter, a different tool for a different job. Virtual Group is pure legibility.

      How it works

      The mechanism lives almost entirely in the frontend JS. The node has two target selectors, and it matches against both:

      • node_ids - a comma-separated list of node IDs and ranges, e.g. 1-3, 6, 9-13.
      • node_names - a comma-separated list of node titles, and * acts as a wildcard. So *upscale* matches any node whose title contains "upscale".

      When you flip expand to false, the extension finds every matching node, remembers each one's original collapsed state, and sets flags.collapsed on them - which is exactly what right-clicking "collapse" does under the hood. Flip expand back to true and it restores each node to its previous state (a node you'd already collapsed stays collapsed; one that was expanded comes back expanded). It even picks the leftmost node as an anchor, and if you delete the Virtual Group node while a group is collapsed, it expands everything first so you don't lose your place - the kind of edge-case care that tells you the author actually uses it.

      The Python side is a noop - it returns nothing, takes nothing that affects the graph. There are no outputs.

      Inputs

      • expand - boolean, default true. This is the master switch.
      • node_ids - string, e.g. 1-3, 6, 9-13.
      • node_names - string with * wildcards.

      Install

      ComfyUI Manager (search "ComfyUI-GadgetNodes"), or:

      cd ComfyUI/custom_nodes
      git clone https://github.com/2daadv/ComfyUI-GadgetNodes.git
      pip install -r ComfyUI-GadgetNodes/requirements.txt
      

      Restart, find it under Gadget/logic.

      Where people get burned

      • Node IDs are fragile. Every time you add or delete a node, ComfyUI renumbers node IDs. A node_ids range that was perfect last week can be pointing at different nodes today. Titles with wildcards survive edits much better - prefer node_names.
      • Nodes 2.0 likely won't render it. This is a classic-frontend canvas extension. The README's compatibility table puts Virtual Group in the "may not work" column for the new frontend, and cautions that group-collapse UI is a known casualty. No runtime impact - it just won't do anything visible.
      • Collapsed ≠ muted. New users grab this expecting to disable a half-finished section. It doesn't. The nodes still run, they still cost VRAM and time. If a branch is expensive and you want it off, bypass or mute it instead.

      It's a quiet organizational node with essentially zero community footprint - the kind of thing you install for the pack's other nodes and then discover. The honest advice: if you live in huge workflows on the classic UI, node_names + wildcards makes this a genuinely pleasant way to clear the canvas. If you're on Nodes 2.0 or you wanted a mute, look elsewhere.

      CategoryGadget/logic

      Inputs (3)

      NameTypeDefaultDescription
      expandBOOLEANtrue
      node_idsoptSTRING
      node_namesoptSTRING

      Outputs (0)

      No outputs