SelectTexts
Turn a comma-separated prompt into toggle buttons, keep what you want
- ANY
- text
SelectTexts is the node that finally makes prompt-tag management feel like a checklist instead of surgery. You feed it a comma-separated prompt - say, a dump of trigger words from LoraTagsOnly, or any tag list - and it renders every item as an ON/OFF toggle button on the node. Items you leave ON get emitted; items you switch OFF are dropped from the output. That's the whole idea, and it's why this node and GetNameForLoraStack were the reason the author built the pack in the first place: auto-pull tags for your LoRAs, then toggle the ones you actually want.
How it works
The input (ANY, forced to be a wire - you can't type into it) is treated as a list. The real brains are a recursive prompt parser. It doesn't just split on commas; it understands nested emphasis groups like (zzz,(aaa,bbb:0.5):0.4), tracks the weight on each group, and - this is the clever part - when you toggle items inside a weighted group, it rebuilds the group correctly. All items in a group OFF and the whole weighted group disappears; some ON and it comes back with the weight and structure intact. So (detailed face:1.4), (blue dress:0.8), character stays structurally correct no matter which toggles you flip.
The output is a single text string, rebuilt from whatever is still ON. Because it parses and re-joins, it also works as a plain list flattener - feed it a list, get a clean comma-separated string.
Two things worth knowing about the plumbing. The toggle state lives in a hidden toggle_states_json widget, synced with a server-side store (the pack registers /select_texts/set_states endpoints) so your switches persist across re-runs and don't get lost to caching. And the node's IS_CHANGED hashes both the input and the toggle state, so it re-runs (and re-renders the toggles) when either changes. The ANY input accepts text or lists but not images, per the README.
Gotchas
- It's an input-driven node. Everything comes in via the wire. If you want to toggle text you typed yourself, feed it through a text node first - there's no editable text box on SelectTexts itself.
- Nested syntax is CLIP-era. The parser handles
(word:1.5)groups beautifully, but remember those weights only mean something on CLIP-encoded models (see the prompt-engineering KB: on LLM encoders the emphasis syntax is literal punctuation). As a toggle + flattener it's model-agnostic; as a weight-preserving rebuilder it's a CLIP tool. - Toggle state is per-node, keyed by node ID. Duplicate a SelectTexts in a workflow and each copy tracks its own switches.
Installation
No dependencies, no downloads - one Python file and one JS extension. Install the pack via ComfyUI Manager (search ComfyUI-Text-Utils-sp) or:
cd ComfyUI/custom_nodes
git clone https://github.com/sp8999/ComfyUI-Text-Utils-sp.git
Restart ComfyUI, find SelectTexts under text_utils_sp. Per the README, it's tuned for the Nodes 2.0 frontend - the toggle UI works on the old v1 renderer but can render at the wrong size, so if the buttons look cramped that's likely the cause.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| ANY | * | — | |
| toggle_states_jsonopt | STRING | {} | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |