> For the complete documentation index, see [llms.txt](https://cbwire.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cbwire.ortusbooks.com/v2-1/essentials/templates.md).

# Templates

Your Wire's HTML. Simple as that. Honestly.

{% hint style="warning" %}
[Wires](/v2-1/essentials/creating-components.md) require a template that contains the HTML to be rendered.&#x20;
{% endhint %}

{% hint style="info" %}
By default, Templates exist within your project under `./views/wires/[templateName].cfm`. You can override the default template location with the configuration setting `templatesLocation.` *See* [*Configuration*](/v2-1/essentials/configuration.md)
{% endhint %}

## Implicit Path

If you haven't specified your template file name inside your Wire using **template**, a template will be implicitly loaded based on the Wire's file name.

```javascript
component extends="cbwire.models.Component" {
    // No template defined.
}
```

For the example above, the template `./views/wires/tasklist.cfm` will be rendered.

{% hint style="info" %}
File names should be lowercase when using Implicit Lookups. This is to avoid issues on case-sensitive file systems.
{% endhint %}

## Explicit Path

You can specify the path to your Template using `template`.&#x20;

```javascript
component extends="cbwire.models.Component" {
    template = "wires/tasklist"; // This will look for ./views/wires/tasklist.cfm

    // template = "path/to/tasklist"; <--- Can use folders
    
    // template = "tasklist.cfm"; <--- Can use .cfm if you like
}
```

{% hint style="warning" %}
In CBWIRE 1.x, you would define the template path using `view` but this has been deprecated and `template` should be used going forward.
{% endhint %}

## onRender

Instead of creating a .cfm template, you can define an onRender() method on your [Wire](/v2-1/essentials/creating-components.md).&#x20;

See the [Wire Lifecycle](/v2-1/essentials/lifecycle-events.md#onrender) page for additional details.

## Prevent Rendering

Within your [Actions](/v2-1/essentials/actions.md), you can call the method `noRender()` to prevent your template from re-rendering. This can reduce the returned payload size for actions that do not change the UI.&#x20;

```javascript
component extends="cbwire.model.Component"{
    // Action
    function updateSession(){
        // prevent UI updating
        noRender();
    }
}
```

## Outer Element

Be sure your template includes a single outer element such as`<div>`.&#x20;

```xml
<!--- GOOD --->
<cfoutput>
    <div>
        <button wire:click="addTask">Add Task</button>
    </div>
</cfoutput>

<!--- BAD --->
<cfoutput>
    <div>
        <button wire:click="addTask">Add Task</button>
    </div>
    <div>
        <h1>Tasks</h1>
    </div>
</cfoutput>
```

{% hint style="warning" %}
If an outer element is not detected, an **OuterElementNotFoundexception** is thrown.
{% endhint %}

{% hint style="success" %}
You can use something other than \<div>\</div>.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cbwire.ortusbooks.com/v2-1/essentials/templates.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
