> ## Documentation Index
> Fetch the complete documentation index at: https://docs.oryx.mechatronstudio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Templates

> Saving signal patterns and reinserting them folded into a single pulse.

A **template** is a signal pattern saved for reuse. It is inserted **folded into
a single pulse**, so you can keep building the signal around it without the
pattern taking over the screen, and it unfolds with a double-click when you need
to edit it.

<Note>
  Templates exist **in digital mode only**. In analog the menu button is disabled
  with a notice.
</Note>

## Two pieces not to be confused

<CardGroup cols={2}>
  <Card title="Saved template" icon="save">
    What is stored in the browser. It comes from marking whole channels or a
    selection of pulses, and **belongs to no project**.
  </Card>

  <Card title="Inserted template" icon="layout-template">
    A template already placed on the timeline. It carries **its own copy** of the
    contents: editing one insertion does not touch the others or the original
    template.
  </Card>
</CardGroup>

## Saving a template

From **Menu → Templates → Save template**. There are two sources:

<Tabs>
  <Tab title="From channels">
    You mark the channels that make up the template. They are stored **whole**,
    and each one remembers which channel it came from so it can go back there
    when inserted.

    The window shows how many are marked out of the total, with *Mark all* and
    *Unmark all* buttons, and flags which ones are hidden on the timeline.
  </Tab>

  <Tab title="From a selection">
    With a stretch of pulses selected, the menu offers to save **just that
    stretch, as one channel**.

    When opened it works like a single-channel template holding that piece of
    signal.
  </Tab>
</Tabs>

The template carries a name, a description and a creation date.

<Warning>
  Templates are **stored in this browser**, not in your account. The window says so
  itself: *"For now it is stored in this browser."* Changing browser or machine, or
  clearing the site data, makes them disappear.

  If the browser refuses to write, it tells you: *"The template could not be stored
  in the browser."*
</Warning>

## Inserting a template

From **Menu → Templates → Open template**:

<Steps>
  <Step title="Pick the template">
    The list shows the name, the source (*Channels* or *Selection*) and the
    creation date. You also delete them from there.
  </Step>

  <Step title="Pick the pulse where it starts">
    The header asks for it: *"Pick the pulse where the 'X' template starts · Esc
    to cancel"*.
  </Step>
</Steps>

### Where each piece goes

Each template channel **goes back to the channel it was saved from**. If that
channel no longer exists, it goes into the free ones, lowest to highest.

If they do not all fit, the app tells you: *"Not every template channel fits: N
were left out."*

<Note>
  Inserting and unfolding a template **add columns** to the timeline, so they need
  the step count unlocked. With the padlock closed it warns: *"Unlock the step
  count to insert or unfold a template."*
</Note>

## Folded and unfolded

<AccordionGroup>
  <Accordion title="Folded">
    It takes up **a single column** across every channel, drawn as a striped high
    pulse. While it is like that, the editor treats it as one more pulse: you can
    select, copy, cut, paste and label it.

    Its real contents only appear when you unfold it, export, or save it again as
    a template.
  </Accordion>

  <Accordion title="Unfolded">
    It shows its steps on the timeline so you can change them. The contents move
    into the project signal, and the template stays empty until you fold it back.

    You unfold it with a **double-click** on the folded column, or from the
    Templates menu.
  </Accordion>
</AccordionGroup>

**Folding** packs it back into a single pulse, with whatever it holds at that
moment.

## The template badge

A badge with its name and its actions appears over the inserted template:

| Action         | What it does                                                |
| -------------- | ----------------------------------------------------------- |
| Click the name | Rename it                                                   |
| **Fold**       | Packs it back up                                            |
| **Dissolve**   | Removes the template and keeps its signal as regular pulses |
| **Delete**     | Removes the template and its stretch                        |

## Copying with templates inside

If a folded template falls inside a stretch you copy, it **travels with its
contents**: pasting it elsewhere it is still a folded template, not a loose
pulse.
