Cursors
Set the position of the text cursor after your template is inserted, by using the {{cursor}} helper.
Use multiple cursors within a template and navigate between them using the ⇥ Tab key (forward) and ⇧ Shift + ⇥ Tab (backward).
Cursors also support placeholder text that can be a default value or an indication that the cursor needs to be replaced.
Let’s say you have a simple greeting template, such as:
Hi ,
Thanks for your time today.
Best regards.
By default, when a template is inserted, the cursor appears at the end. To change this, use the {{cursor}} helper to specify the exact position of the text cursor. For example, adding {{cursor}} after Hi in the template will allow you to immediately type the recipient's name after inserting it.
Thanks for your time today.
Cursor placeholders
Cursors support placeholder text that will be automatically selected when you reach them. This lets you either set a default value for the cursor, in case you don’t want to change it, or use any text to mark the cursor.
To set a placeholder for the cursor, use the cursor block helper:
Style and formatting
You can use any text as a cursor placeholder, and you can apply text formatting (like bold or italic) and styling (such as colors or spacing) to it.
To make sure formatting and styling are kept when you replace the placeholder text (by typing), apply those styles to the entire cursor expression (including the {{#cursor}} and {{/cursor}} tags).
If you want the styles to be used only for the placeholder text and automatically removed when you start typing (so the new text inherits the surrounding style), apply the formatting only to the placeholder text itself (excluding the {{#cursor}} and {{/cursor}} tags).
Dynamic data and variables
Because placeholders accept any text, you can include other helpers or dynamic variables within the placeholder content.
Using dynamic variables in a cursor
You can use a dynamic variable as the content for a cursor placeholder. For instance, to automatically select the recipient's first name after inserting the template, use the block syntax:
When the template is inserted, the recipient's first name will be selected, letting us immediately type and replace it if needed.
Conditionally creating a cursor
You can also use conditionals to create a cursor only when necessary. This is useful for providing a fallback placeholder when a dynamic variable is unavailable:
If the recipient's first name is available (e.g., "John"), the template will insert Hi John, and place the cursor at the end.
If the first name is not available, it will insert and select "FILL-IN FIRST NAME". We can start typing to replace it.
We use a different syntax for cursors here. Instead of using the block syntax {{#cursor}} FILL-IN FIRST NAME {{/cursor}}, we use a shorter version {{cursor "FILL-IN FIRST NAME"}}.
We recommend using the block syntax most of the time ({{#cursor}}..{{/cursor}}), as this lets you add styles to placeholders. But, when you need to use more complex conditionals like the one above, you can use the shorter inline syntax.
Using helpers as cursor placeholders
You can also use other helpers as subexpressions in cursor placeholders, just as you would with dynamic variables. By combining multiple cursors with the date and time helper, for example, you can create a basic date picker:
Multiple cursors
You can add as many cursors in a template as you need.
When you insert a template, the first cursor in the template will be selected. You can move to the next one by pressing ⇥ Tab . You can then move to the previous cursor by pressing ⇧ Shift + ⇥ Tab .
- Empty cursors (with no placeholder) can only be reached once.
- Cursors with placeholders can be reached until you change their value.