ComfyUI Extension: ComfyUI Subject Selector
ComfyUI_subjectselector is a custom ComfyUI node that allows you to manage and select text-based subject descriptions directly from the workflow UI. This node was designed to pair seamlessly with a/ComfyUI-textsplit, providing a clean, modular way to feed descriptive text prompts into your generation pipeline.
Custom Nodes (0)
README
# 🧩 ComfyUI Subject Selector
**ComfyUI_subjectselector** is a custom ComfyUI node that allows you to manage and select text-based subject descriptions directly from the workflow UI.
This node was designed to pair seamlessly with [ComfyUI-textsplit](https://github.com/vsaan212/Comfy-ui-textsplit), providing a clean, modular way to feed descriptive text prompts into your generation pipeline.
Sample workflow and flow image in textsplit
## 🚀 Features
* ✅ Automatically loads all .txt files from a SubjectFiles/ folder
* ✅ Displays each file name in a **dropdown selector**
* ✅ Outputs the contents of the selected file as text
* Broken - restart of comfyui needed - Includes a **“Refresh Subjects”** button to reload the list without restarting ComfyUI
* ✅ Fully compatible with **textsplit** or any node expecting a text input
## 📂 Folder Structure
ComfyUI/
└── custom\_nodes/
    └── ComfyUI\_subjectselector/
        ├── \_\_init\_\_.py
        ├── ComfyUI\_subjectselector.py
        └── SubjectFiles/
            ├── subject1.txt
            ├── subject2.txt
            └── ...
## 🧠 How It Works
1. Each .txt file in SubjectFiles/ represents one selectable option in the node’s dropdown.
2. The **filename (without .txt)** becomes the dropdown label.
3. When selected, the **entire file contents** are output as text to downstream nodes.
4. Clicking “⟳ Refresh Subjects” re-scans the folder and updates the list dynamically.
## ⚙️ Installation
1. Navigate to your ComfyUI install directory:
```
cd ComfyUI/custom_nodes
```
2. Clone or create the new node:
```
mkdir ComfyUI_subjectselector
cd ComfyUI_subjectselector
```
3. Add the two required files:
   * ComfyUI\_subjectselector.py → [latest version here](#)
   * (Optional) \_\_init\_\_.py (can be empty)
4. Create a folder:
```
mkdir SubjectFiles
```
5. Add one or more .txt files, for example:
```
subject1.txt
subject2.txt
```
6. Restart ComfyUI (first time only).
## 🧩 Usage in ComfyUI
1. Add the **Subject Selector** node (Custom → Subject).
2. Select a subject from the dropdown.
3. (Optional) Click **“⟳ Refresh Subjects”** if you added new .txt files.
4. Connect the **Text Output** to the textsplit node input.
Example flow:
\[ComfyUI\_subjectselector] → \[textsplit] → \[lora selector]\[loraselector]\[CLIPTextEncode]
## 🪶 Example Subject Files
Each .txt file can contain any text block, such as a character description or scene summary. when using it with the textsplit node you would be able to split the sections to diffrent nodes in comfyui.
Example subject1.txt with the seperator #
wan2.2Loras\subject\subject1.safetensors
#
wan2.2Loras\clothing\Dress.safetensors
#
Subject1, a 38-year-old woman with a heart-shaped face and blue-green eyes, under soft morning light.
When selected, this entire text will be output to your connected node (e.g., textsplit).
test split will take the first section and feed it into lora high (requiers lora loader with input where lora name is)
the 2nd section will feed into lora low (requiers lora loader with input where lora name is)
and the last section into the prompt combine workflow.
## 🔁 Refreshing Subjects
You can add, remove, or rename .txt files at any time.
To update the dropdown:
* Click the **Refresh Subjects** button inside the node
* OR remove and re-add the node to your workflow
No restart required.
## 🤝 Integration with textsplit
When used with [ComfyUI-textsplit](https://github.com/vsaan212/Comfy-ui-textsplit):
* The ComfyUI\_subjectselector node outputs your chosen subject description.
* textsplit takes that text and segments it into smaller parts for multi-line or structured prompt generation.
* This makes it ideal for LoRA testing, prompt templates, or dataset generation workflows.
## 🧩 Node Details
**Node Name:** ComfyUI\_subjectselector
**Category:** Custom/Subject
**Output Type:** STRING
**Output Name:** text
**Dependencies:** None (pure Python)
## 🛠️ Optional Improvements
Future versions may include:
* Hot reload via file watcher (auto refresh without manual click)
* Multi-select subjects
* Combined output (merge multiple .txt files)
* Preview window showing selected text
## 🧾 License
This node is released under the MIT License.
Feel free to fork, modify, and integrate into your own custom ComfyUI toolkits.