Prompt Preset Selector
Wildcard blocks without the wildcard syntax — one spinner, every prompt variant
- text
- preset_list
- selected_info
The old wildcard trick - write {this|that|the other} in a prompt and let each run pick a combination - is one of the best ways to batch variety without writing more prompts. PromptPresetSelector is that idea, but deterministic: instead of randomly picking, a single index spinner chooses the option for every block in your text at once. Flip it and your whole prompt swaps to another preset. It's the most feature-packed node in ComfyUI-RE-CustomUtils, and the one you'll probably build a workflow around.
The core idea
You write text with {% ... %} blocks, options separated by |:
This is {% an example | a text | another text %} for {% the PromptPresetSelector | the README | %}
With preset_index at 0 you get "This is an example for the PromptPresetSelector"; at 1, "This is a text for the README"; at 2, "This is another text for". Every block must have the same number of options, and the index picks that option out of every block. Empty options are legal - the block just collapses to nothing.
That means one node holds a whole family of prompts: a base template with the subject, framing, lighting and style each as a block, and you sweep the index to generate variations. It's the bracket trick from the A1111 days, minus the randomness and minus the syntax everyone forgot.
The inputs that matter
syntax- definesopen_tag separator close_tag, space-separated. Default{% | %}. Want<< a / b >>blocks? Set<< / >>.preset_index- the selector, 0-based, and it loops in both directions when you spin past the ends.preset_names+preset_name- fillpreset_nameswithneutral, happy, sadand the spinner becomes a named dropdown instead. Fewer names than presets? The rest auto-name (preset_2,preset_3…). More names than presets? Extras are ignored.text- your template with blocks. It gets a syntax-highlighted editor (tags in orange, inactive presets gray) and supportsCtrl+Up/Ctrl+Downto weight the word under the caret, native ComfyUI style.cleanup- on by default; strips the comma-and-paren debris that empty presets leave behind.
There's also $N reference syntax for stacking presets on top of each other:
{% base style | $0, hat | $1, jewelry %}
Preset 1 includes preset 0 plus "hat"; preset 2 includes preset 1 plus "jewelry". References resolve recursively, but only backwards - you can't reference a preset declared after the current one, and circular references error out. It's a neat little dependency system for prompt layers.
Outputs: text (the resolved prompt), preset_index (echoes your selection), and preset_count (how many options the blocks hold - handy for looping a batch).
Installing it
It's in ComfyUI-RE-CustomUtils. ComfyUI Manager → search the pack title, or:
cd ComfyUI/custom_nodes
git clone https://github.com/relhamdi/ComfyUI-RE-CustomUtils
Restart ComfyUI. No extra dependencies - the pack only declares torch.
Where people get burned
The node is strict on purpose, and it stops the workflow rather than guessing:
syntaxmust be exactly three space-separated parts, and the open/close tags must differ.- All blocks must have the same option count. Mix a 2-option block with a 3-option block and it refuses.
- Index out of range raises.
That strictness is a feature when you're pasting a workflow someone shared - a template that violates the rules fails loudly instead of quietly producing a mangled prompt. The one thing to watch: the syntax-highlighted editor is picky about how you format blocks, so if a highlight looks off, check your syntax field first.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| preset_file | COMBO | 1 options: (No preset files found) | |
| absolute_path | STRING | — | |
| keyword | STRING | — | |
| keyword_mode | COMBO | OFF | 3 options: OFF, AND, OR |
| selection_mode | COMBO | Manual | 4 options: Manual, Sequential, Sequential (continue), Random |
| preset_index | INT | 00–9999 | — |
| seed | INT | 00–18446744073709550000 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| preset_list | STRING | — |
| selected_info | STRING | — |