String Combiner
The prompt-variation node that does the cartesian product for you
- combined_string
- index
- total_combos
If this pack had one node I'd call a sleeper hit, it's String Combiner. It takes up to ten lists of strings, generates every combination across them, and serves them up one at a time through a single template. It's the thing you'd otherwise build with a spreadsheet, and it does it natively in the graph.
How it works
Three controls and up to ten inputs. Set num_lists (1–10, default 2) to choose how many of the list_1 through list_10 slots are active, wire your lists in, and write a template using %1, %2, … placeholders. Default template is %1, %2. The index input (default 0) picks which combination comes out.
Under the hood it's a cartesian product: with a 3-item list and a 4-item list, you get 12 total combinations. The math is:
total_combos(an output) = product of all list lengthsindexselects which combo, computed so that the last list varies fastest- set
indexto -1 and it picks a random combination each run
You get three outputs: combined_string (the rendered template), index (the combo that was actually used - useful when you picked -1), and total_combos.
Why that's useful
This is the missing link for prompt sweeps. Feed it a list of subjects and a list of styles, wire combined_string into a CLIP Text Encode, drive index from an incrementing node, and ComfyUI grinds through every subject×style pairing in order. Raise num_lists to three or four and you're doing real factorial-style experimentation without writing a single Python node. If you've ever batched "how would this look in every style," this node is your answer.
Install
Part of ComfyUI-TinyBee. ComfyUI Manager → search ComfyUI-TinyBee → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/TinyBeeman/ComfyUI-TinyBee
It appears under 🐝TinyBee/Strings. Pure stdlib; no models, no extra dependencies.
Gotchas
The template replacement is literal: placeholders are %1–%N and each is replaced with the string at that position in the combination. The node also always reports itself as changed, so it re-renders every execution rather than caching. One trap: the index output after a -1 (random) pick is the actual chosen combo, which is what you want if you need to reproduce it. And if a list is empty, its slot contributes nothing to the combination but also nothing to the count - an empty list makes that position render as an empty string while total_combos still multiplies by 1. Keep your lists non-empty and the behavior is predictable.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| num_lists | INT | 21–10 | — |
| template | STRING | %1, %2 | — |
| index | INT | 0-1–2147483647 | — |
| list_1opt | STRING | — | |
| list_2opt | STRING | — | |
| list_3opt | STRING | — | |
| list_4opt | STRING | — | |
| list_5opt | STRING | — | |
| list_6opt | STRING | — | |
| list_7opt | STRING | — | |
| list_8opt | STRING | — | |
| list_9opt | STRING | — | |
| list_10opt | STRING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| combined_string | STRING | — |
| index | INT | — |
| total_combos | INT | — |