Template Variables
Template variables let you create dynamic prompts that change based on variable values. Instead of writing a separate prompt for every variation, you define placeholders using the {{variable_name}} syntax and swap values at generation time -- ideal for batch generation across different products, names, or descriptions.
What Are Variables?
A template variable is a named placeholder inside a prompt. When you run a generation, XainFlow replaces each placeholder with the value you provide. This turns a single prompt template into a reusable blueprint for many outputs.
Example prompt with variables:
A professional photo of {{product_name}} on a {{background_type}} background,
studio lighting, {{style}} style
When you generate, you provide values like product_name = "running shoes", background_type = "white marble", and style = "minimalist", and the AI receives the fully substituted prompt.
Variable Types
| Type | Description | Example Value |
|---|---|---|
| Text | Free-form text input | "running shoes", "sunset beach" |
| Number | Numeric values | 3, 1080, 0.5 |
| Image | Reference to an image asset | An uploaded product photo |
Creating Variables
- Open a workflow in Flow Studio.
- Select a node that accepts prompts (such as the Prompt Generator Node).
- In the prompt field, type
{{to start a variable placeholder, then enter the variable name and close with}}. - The variable appears in the Variables Panel on the side, where you can set its type and default value.
Using Variables for Batch Generation
Variables are most powerful when combined with batch generation:
- Define your prompt template with one or more
{{variables}}. - Open the Variables Panel.
- Provide multiple value sets -- one for each variation you want to generate.
- Run the workflow. XainFlow generates one output per value set.
Use descriptive variable names like {{product_name}} or {{scene_description}} rather than generic names like {{var1}}. This makes your templates easier to understand and maintain, especially when sharing workflows with team members.
Variable Management
You can manage all variables for a workflow from the Variables Panel:
- Edit -- change a variable's name, type, or default value.
- Delete -- remove a variable you no longer need. Any prompt references to that variable will show as unresolved.
- Reorder -- drag variables to change their display order in the panel.
Related Pages
- Prompt Generator Node -- the primary node where variables are used
- Custom Styles -- pair variables with style presets for maximum flexibility
- Flow Studio