Extensions/ComfyUI TextInputSelector
ComfyUI Extension

ComfyUI TextInputSelector

ComfyUI text input node with prefix/suffix blocks and Python-slice-style block selection

By h1531095·Created 2 months ago·Updated 2 months ago· 1
h1531095/Comfyui-TextInputSelector
Nodes—
On cloudLocal install
Stars1
Updated2 months ago
Readme

ComfyUI TextInputSelector

A ComfyUI custom node that combines text blocks from prefix, main text, and suffix inputs, then selects which blocks to pass through using a Python-slice-style selector expression.

Node ID: CustomTextInputSelector_Standalone Display name: Text Input (Custom Selector) Category: custom/text

Inputs

| Name | Type | Required | Description | |------|------|----------|-------------| | text | STRING (multiline) | yes | Main text block | | selector | STRING | yes | Selection expression (default : = all blocks) | | prefix | * (any) | no | Prepended block(s); accepts any input type | | suffix | * (any) | no | Appended block(s); accepts any input type |

Outputs

| Index | Name | Type | Description | |-------|------|------|-------------| | 0 | text_list | LIST | The selected blocks as a list | | 1 | concat_text | STRING | Selected blocks concatenated (no separator) |

Selector syntax

Block order is: all prefix blocks, then text, then all suffix blocks.

| Expression | Meaning | |------------|---------| | (empty) | All blocks | | 2 | Block index 2 (negative counts from the end, e.g. -1 = last) | | 0,2 | Indices 0 and 2 | | 1:3 | Range from index 1 up to (excluding) 3 | | -2: | Last two blocks |

Out-of-range single indices are ignored; ranges are clamped to valid bounds.

Example

With prefix="A", text="B", suffix="C" there are 3 blocks [A, B, C]:

  • selector 1: -> output "BC" and list ["B", "C"]
  • selector 0,-1 -> output "AC"
  • empty selector -> output "ABC"

Installation

Clone into your ComfyUI custom_nodes/ directory and restart ComfyUI:

cd ComfyUI/custom_nodes
git clone https://github.com/h1531095/Comfyui-TextInputSelector

No external dependencies required.

License

MIT