For the complete documentation index, see llms.txt. This page is also available as Markdown.

Building Reusable Template Sections

Component Templates Tutorial

The Scenario: Sending a Welcome Packet to New Employees

Imagine you work in HR. Every time someone is hired, you send a Welcome Packet. But not everyone gets the same packet.

  • Situation A - John is hired in the Sales department. He should receive the Sales Welcome Section.

  • Situation B - Maria is hired in Engineering. She should receive the Engineering Welcome Section.

  • Situation C - Emily is a Remote employee. She should also receive the Remote Work Policy Section.

The Old Way: You create different templates to address each team which would be hard to maintain and easy to pick wrong one. Example:

  • Sales Welcome Template

  • Engineering Welcome Template

  • Sales + Remote Policy Template

  • Engineering + Remote Policy Template


The S-Docs Way

You create One Parent Template and + Small Reusable Components

The parent decides what to include.


1

Step 1: Create the Parent Template

This is your main Welcome Packet.

Example:

This part never changes.

2

Step 2: Create Simple Components

Now create small reusable sections.

Template Format → Component

Component 1: Sales Welcome Section

Component 2: Engineering Welcome Section

Component 3: Remote Work Policy Section

Each of these is a standard Component template.

3

Step 3: Insert Components into Parent

Now inside the Parent Template, add a Component Merge Field where the section should appear.

Static component

That inserts the component named Sales Welcome Section.

Department-Based Dynamic Component

Let’s assume we have a field:

It contains either:

  • Sales

  • Engineering

Now we write:

What happens?

If Department = Sales → It loads: Welcome Sales Section

If Department = Engineering → It loads: Welcome Engineering Section

That’s dynamic components in the simplest form.

4

Step 4: Adding the Remote Policy Only If Needed

Now we check:

If Employee.Remote__c = TRUE

We add the Remote Work Policy Section.

Now:

Remote employee → section is included Office employee → section is skipped


What Just Happened?

You built:

  • 1 Parent Template

  • 3 Small Components

And parent template decides what to include.

No duplicate templates. No manual decisions. No errors.


Even Simpler Model

Think of it like this:

Parent Template = Table of Contents Components = Chapters

The parent says:

  • Always include Chapter 1

  • Include Chapter 2 if Sales

  • Include Chapter 3 if Engineering

  • Include the remote policy section if Remote

That’s it.


When Should You Use Components?

Use them when:

  • A section repeats across templates

  • A section is large (legal, pricing, policy)

  • A section may appear conditionally

  • You want cleaner, more readable parent templates


When NOT to Use Components

Don’t use a component for:

  • A single line of text

  • Tiny conditional phrases

  • One-time content

Components are for sections, not single sentences.

Last updated

Was this helpful?