> For the complete documentation index, see [llms.txt](https://help.sdocs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.sdocs.com/sdocs/advanced-template-logic/build-reusable-templates/component-template-how-to-article.md).

# Component Template How-to Article

{% stepper %}
{% step %}

#### Create a new S-Docs template

{% endstep %}

{% step %}

#### Set **Template Format** to `Component`

{% hint style="info" %}
If `Component` does not appear in the Template Format picklist, you can manually add it:

Setup → Object Manager → SDoc Template → Fields & Relationships → Template Format → Values
{% endhint %}
{% endstep %}

{% step %}

#### Build the component like a normal S-Docs template

{% hint style="warning" %}
Important limitations:

* No Header/Footer tab
* No Page Settings
* No Email or Output configuration\
  (All of these are controlled by the parent template)
  {% endhint %}
  {% endstep %}
  {% endstepper %}

{% hint style="info" %}
Looking to start new?

Start with the [Component Templates Tutorial](broken://spaces/WKNnJmhJBQwhdk5WBFsi/pages/MmgMvojS6jMquOp1eOBS).
{% endhint %}

### How to Include a Component in a Parent Template

#### Using the Insert Field Tool within the template editor

1. Open your parent template
2. Place your cursor where the component should appear
3. Click **Insert Field**
4. Go to the **Other Templates** tab
5. Select your component and click **Insert**

This method works best when the component and parent share the same base object.

#### Using Merge Field Syntax Directly

PDF-based templates:

```
{{{{!My Component Template}}}}
```

DOCX templates:

```
[{{{{!My Component Template}}}}]
```

### More component topics

<table data-column-title-hidden data-view="cards"><thead><tr><th>Title</th><th>Description</th><th data-card-target data-type="content-ref">Target</th></tr></thead><tbody><tr><td>Component (DOCX)</td><td>Use DOCX component templates in DOCX parent templates.</td><td><a href="/pages/FvhSrt3zWGMV9LhaAC7e">/pages/FvhSrt3zWGMV9LhaAC7e</a></td></tr><tr><td>PDF-Upload as a Component</td><td>Merge PDF-Upload templates into supported parent templates.</td><td><a href="/pages/Q59JbcKYVMQUMpYgf3mg">/pages/Q59JbcKYVMQUMpYgf3mg</a></td></tr><tr><td>Using Component Queries</td><td>Repeat a component once per record returned by a SOQL query.</td><td><a href="/pages/bqedg0818Y4z3baQzGBH">/pages/bqedg0818Y4z3baQzGBH</a></td></tr><tr><td>Combining Components with Render Logic</td><td>Use conditional logic inside component templates.</td><td><a href="/pages/9cBRZdRlwbX5nsy07RC1">/pages/9cBRZdRlwbX5nsy07RC1</a></td></tr><tr><td>Dynamic Components</td><td>Choose which component to render at runtime based on Salesforce data.</td><td><a href="/pages/tnAMcJihlL3EdmCpKs0m">/pages/tnAMcJihlL3EdmCpKs0m</a></td></tr></tbody></table>


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.sdocs.com/sdocs/advanced-template-logic/build-reusable-templates/component-template-how-to-article.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
