# Dashboard tools for Handlebars

Built-in tools that simplify entering Handlebars expressions.

Handlebars is Airship's templating language for personalization. Handlebars expressions use double curly braces wrapped around a content template, ranging from a simple variable, e.g., `{{first_name}}`, to complex evaluations of personalization data.

![Dashboard tools for entering Handlebars expressions](https://www.airship.com/docs/images/pers-tool_hu_6ae6bb8dceb13893.webp)

*Dashboard tools for entering Handlebars expressions*

We provide tools in the dashboard that simplify adding and formatting **merge fields** and **logic statements** that conditionally render content.

When entering content in text fields, click **</>** to start creating merge fields or logic statements for the Text and Number [Attributes](https://www.airship.com/docs/reference/glossary/#attributes) in your project.

These options are available for most text fields, such as message body, button labels, URLs, [Custom Keys](https://www.airship.com/docs/reference/glossary/#custom_keys), and pasted or uploaded HTML in the Interactive editor.

See also: [Handlebars reference](https://www.airship.com/docs/guides/personalization/handlebars/).

## Merge fields tool

A merge field is a variable in your message or template that you want to populate with a personalized value for each member of the audience. Merge fields are the most basic Handlebars expression.

Using this tool, your expression is inserted in the text field in the format `{{attribute_id}}` or `{{$def attribute_id "default_value"}}`.

![Creating a merge field using the dashboard tool](https://www.airship.com/docs/images/pers-tool-merge-field_hu_6a05f853f8fce0f1.webp)

*Creating a merge field using the dashboard tool*

---

When entering content in text fields:

1. Click **</>** and select *Merge field*.
1. Search for an attribute and select from the list. You can search by attribute name or ID.
1. Do **one** of the following:
   * Enter a default value that will be used if the merge field is empty.
   * Leave the default value blank and check *Allow empty values*.
1. Click **Insert**.

---

After inserting, you can edit the `"default_value"` or delete the entire handlebars string to remove it.

## Logic statements tool

Logic statements include conditional requirements. The first statement you add is an `if`, which means your content is rendered in your message if the statement is true. You can then add `else if` and `else` statements. Each additional statement is a condition that builds on the preceding one, and all are formatted as a single expression.

* **Statement 1:** `if` — The specified text is displayed if the statement is true. *Only this initial statement is required.*

* **Statement 2:** `else if` — The specified text is displayed if statement 1 is false and statement 2 is true. *You can add multiple `else if` statements.*

* **Statement 3:** `else` — The specified text is displayed if all preceding statements are false. *You can add an `else` statement without adding any `else if` statements.*

See also: [Handlebars Reference: If/Else Statements](https://www.airship.com/docs/guides/personalization/handlebars/logic-helpers/#ifelse).

---

![Creating a logic statement using the dashboard tool](https://www.airship.com/docs/images/pers-tool-logic-statement_hu_ad7dc948f4a37ca3.webp)

*Creating a logic statement using the dashboard tool*

When entering content in text fields:

1. Click **</>** and select *Logic statement*.
1. Search for an attribute and select from the list. You can search by attribute name or ID.
1. Select the operator you want to use, and enter a value. Available operators depend on the attribute type (Text or Number). As you add and edit statements, the code output that will be inserted in your message displays at the bottom of the window.
1. Click **Add content**, enter the content you want to display in the message when the statement is true, then click **Apply**.
1. (Optional) Click 
 to add `else` and/or `else if` conditions and complete previous steps.
1. Click **Insert**.

After inserting, you can edit the display text for each statement or delete the entire handlebars string to remove it.

### Example logic statement

In this example, we want to show existing loyalty program members a discount code and non-members a signup message. We will build this expression based on attribute `loyalty_status`.

![Setting attribute operator and value](https://www.airship.com/docs/images/pers-tool-logic_hu_f8a1f4f033513dcb.webp)

*Setting attribute operator and value*

First set the attribute to equal value `member`.

![if statement ](https://www.airship.com/docs/images/pers-tool-logic-if_hu_d61653f04f17117a.webp)

*if statement *

Then enter content `Thank you for being a loyalty member. Use code UNDOCK to get an extra 10% off this purchase.`.

![else statement](https://www.airship.com/docs/images/pers-tool-logic-else_hu_c7c1d1813a711faa.webp)

*else statement*

Next add an `else` statement, for users for whom the first statement is false, and enter the content those users will see instead: `Like great savings? Sign up to become a loyalty member today!`.

![Your coded expression](https://www.airship.com/docs/images/pers-tool-logic-output_hu_4d5d2d73d11087f4.webp)

*Your coded expression*

The code updates as you add and edit statements. Click **Insert** to add the expression to your message.
