ComfyUI Node

Text Box Style

The caption box behind your ComfyUI text

By drmbt·Created 2 years ago·Updated 7 months ago· 6
Text Box Style
    • TEXTBOX
    colorblack
    opacity0.20
    border_colorblack
    border_opacity1.00
    border_width6
    corner_radius0
    padding_left24
    padding_right24
    padding_top24
    padding_bottom24
    full_widthfalse
    color_hex#FFFFFF
    border_hex#000000

    Text Box Style is the styling companion to the pack's Draw Text node. Draw Text renders the words; this node draws the box behind the words. If you've ever wanted a subtitle card, a watermark band, or a caption plate on a generated image and got tired of fiddling with masks and compositing, this is the part of the graph that stops being annoying.

    The key thing to understand: this node doesn't render anything. It's a style preset. You dial in the fill, border, padding, and corner radius, and it hands a TEXTBOX object to Draw Text's optional textbox input, which does the actual drawing. Think of it as a saved theme you can wire in, tweak once, and reuse across ten workflows.

    What you actually set

    Most of the inputs are styling sliders, and the defaults are sensible enough to run with:

    • color and opacity - the box fill. Opacity defaults to 0.2, which reads as a subtle glassy band rather than a solid slab.
    • border_color, border_opacity, border_width - the outline, defaulting to a thin black edge at full opacity.
    • corner_radius - rounded corners in pixels. 0 is sharp, 100 is pill-shaped.
    • padding_left/right/top/bottom - how much breathing room between text and the box edge. Each defaults to 24px, and yes, you can go negative to shrink the box under the text.
    • full_width - stretches the box to the margins based on text alignment instead of hugging the text.

    The one subtlety worth knowing: colors can be a named preset (black, white, red, …) or a custom color_hex / border_hex. An 8-digit hex like #00000080 includes alpha, and it overrides the opacity slider. That's the author's design - opacity is the lazy path, hex gives you exact control. Use 8-digit hex when you need a precise alpha, use the sliders when you're still experimenting.

    Wiring it in

    Drop the TEXTBOX output into Draw Text's textbox input, then let Draw Text's own alignment options place both text and box. If you only want a translucent band across a composed image, set color to transparent and leave the border - instant caption plate.

    Gotchas

    Because this ships inside comfyui-dreambait-nodes, you get the whole pack's dependency list whether you like it or not - installing for one text box pulls in transformers, bitsandbytes, librosa and friends, which is a lot of weight for a caption. If you're on ComfyUI Manager, search "comfyui-dreambait-nodes" and let it handle the pip install; otherwise:

    cd ComfyUI/custom_nodes
    git clone https://github.com/drmbt/comfyui-dreambait-nodes
    # restart ComfyUI
    

    Two real-world traps: if Draw Text isn't in your graph the TEXTBOX wire has nowhere to go (there's no standalone output), and 8-digit hex quietly ignoring your opacity slider confuses everyone once. Neither is a bug - it's just how the alpha is meant to work. For the other text-styling helpers in the pack (Text Margins, Text Shadow, Draw Mana), you'll find the same pattern: preset nodes feeding one renderer.

    CategoryDreamBait/Text

    Inputs (13)

    NameTypeDefaultDescription
    colorCOMBOblackBox fill color. Alpha controlled by opacity unless using 8-digit hex
    opacityFLOAT0.200–1Box opacity (ignored if using 8-digit hex color)
    border_colorCOMBOblackBorder color. Alpha controlled by border_opacity unless using 8-digit hex
    border_opacityFLOAT1.000–1Border opacity (ignored if using 8-digit hex color)
    border_widthINT60–100Border width in pixels
    corner_radiusINT00–100Corner radius in pixels
    padding_leftINT24-4096–4096Left padding in pixels (negative values shrink the box)
    padding_rightINT24-4096–4096Right padding in pixels (negative values shrink the box)
    padding_topINT24-4096–4096Top padding in pixels (negative values shrink the box)
    padding_bottomINT24-4096–4096Bottom padding in pixels (negative values shrink the box)
    full_widthBOOLEANfalseExtend box to margins based on text alignment
    color_hexoptSTRING#FFFFFFCustom hex color (6 or 8 digits). 8-digit hex overrides opacity
    border_hexoptSTRING#000000Custom border hex color (6 or 8 digits). 8-digit hex overrides border_opacity

    Outputs (1)

    NameTypeDescription
    TEXTBOXTEXTBOX