> 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="https://help.sdocs.com/sdocs/advanced-template-logic/build-reusable-templates/component-template-how-to-article/component-docx.md">Component (DOCX)</a></td></tr><tr><td>PDF-Upload as a Component</td><td>Merge PDF-Upload templates into supported parent templates.</td><td><a href="https://help.sdocs.com/sdocs/advanced-template-logic/build-reusable-templates/component-template-how-to-article/combining-components-with-render-logic.md">Combining Components with Render Logic</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="https://help.sdocs.com/sdocs/advanced-template-logic/build-reusable-templates/component-template-how-to-article/using-component-queries.md">Using Component Queries</a></td></tr><tr><td>Combining Components with Render Logic</td><td>Use conditional logic inside component templates.</td><td><a href="https://help.sdocs.com/sdocs/advanced-template-logic/build-reusable-templates/component-template-how-to-article/pdf-upload-as-a-component.md">PDF-Upload as a Component</a></td></tr><tr><td>Dynamic Components</td><td>Choose which component to render at runtime based on Salesforce data.</td><td><a href="https://help.sdocs.com/sdocs/advanced-template-logic/build-reusable-templates/component-template-how-to-article/dynamic-components.md">Dynamic Components</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 by asking a question.

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

```
GET https://help.sdocs.com/sdocs/advanced-template-logic/build-reusable-templates/component-template-how-to-article.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.
