---
title: "How to insert attribute values into a custom popup"
description: "Show each feature's own attribute values in a custom popup with variables such as {population}. Insert them from the toolbar or type them in."
seo:
  title: "Insert attribute values in popups"
sidebar:
  label: "Insert attribute values"
---

Attribute variables let each feature show its own value — `Population: {population}` reads `Population: 1,247` on one feature and `Population: 3,490,238` on the next, formatted per the layer's `Format` tab. Click `Insert simple variable` in the popup editor toolbar (or type `{field_name}`) to insert one; variables substitute the value only (not the alias label), and missing or empty attributes render as blank, so wrap variables in a [conditional](/docs/configuring-popups/add-conditional-content-to-popup) when some features have no value.

**[See it on an example map](https://mangomap-staging.com/examples-staging/maps/y4h0ctdr/popup-media-logic-lab)**

Open the Popup Media & Logic Lab. In the legend, turn on `Planning Areas — Values`. Click an area. Its popup shows that area's `Population`, `Area`, and `Last updated` values.

## Before you start

- The popup type must be `Custom`. See [How to write a custom popup template](/docs/configuring-popups/write-custom-popup-template) for the basic flow.
- The attributes you want to insert must exist on the layer. Check the layer's attribute list (visible on the [`Format` tab](/docs/formatting-attributes/attribute-format-reference)).

## Insert a variable in the editor

In the Custom popup editor, place the cursor where you want the value to appear. Click `Insert simple variable` in the toolbar. The button shows only when the layer has attributes.

The editor opens a list of the layer's attributes. Click the attribute to insert. The variable appears in the editor as a chip, so you can tell it apart from plain text:

<img src="/_assets/configuring-popups/insert-attribute-values-into-popup--editor.png" alt="Popup editor with Type set to Custom, Title {name}, the editor toolbar, and the lines Population: {population}, Area: {area_km2} km², and Last updated: {last_updated}, each variable shown as a chip" width="1600" height="960" />

You can also type the variable directly: type `{` followed by the field name and `}`. The editor recognises the syntax and renders it as a variable chip.

To change a variable, hover over its chip and click `Edit variable`. The list of attributes opens. Click another attribute. To remove the variable, click `Delete variable`.

To type between two chips, click the gap between them. For example, type `-` between `{book}` and `{page}` to show `{book}-{page}`.

## Insert a variable in the popup Title

The `Title` field above the editor accepts variables too. Click `Insert simple variable` at the right edge of the field, then pick the attribute. The variable goes in at the cursor position.

Variables in the title work the same way as variables in the body — they substitute per-feature at render time.

## How values render

When the popup opens for a specific feature, MangoMap substitutes each `{field_name}` with that feature's value for the attribute. The substitution respects the Format tab:

- The format (`Number`, `Currency`, `Date & Time`, `Measurement`) controls how the value displays. `12345.6789` becomes `12,345.68` if you've set `Number → Float` with two decimals, or `12,346` if you've set `Number → Rounded`.
- The alias does not affect the substitution — variables substitute the _value_, not the label. If you want a label next to the value, type the label text in the editor next to the variable: `Population: {population}`.
- The visibility eye does not affect variable substitution. A variable resolves even if the attribute is hidden in the default popup.

For attributes without a format set, the raw value is substituted as text.

## Variables in URLs and other attributes

Text in the popup shows the value with its format from the Format tab. Addresses and equations use the raw value instead:

{/* diagram:popup-values-flow */}
<svg class="dark:hidden" style="width: 100%; height: auto" viewBox="0 0 640 412" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="popup-values-flow-inline-title popup-values-flow-inline-desc">
  <title id="popup-values-flow-inline-title">Where a value is formatted</title>
  <desc id="popup-values-flow-inline-desc">Data flow: a clicked feature’s raw values pass through the Format tab only on their way into popup text, the Title and button text; link, button, image and embed addresses use the raw value, an empty value drops an embed, and equations use the raw values as numbers and round the result to their Decimal Places.</desc>
  <defs>
    <marker id="popup-values-flow-inline-arrow" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto"><polygon points="0 0, 8 3, 0 6" fill="#525252"/></marker>
    <marker id="popup-values-flow-inline-arrow-accent" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto"><polygon points="0 0, 8 3, 0 6" fill="#c4360c"/></marker>
  </defs>
  <rect width="100%" height="100%" fill="#f5f5f5"/>
  <path d="M260 68 L260 92 Q260 100 252 100 L120 100 Q112 100 112 108 L112 130" fill="none" stroke="#525252" stroke-width="1.2" marker-end="url(#popup-values-flow-inline-arrow)"/>
  <path d="M320 68 L320 254" fill="none" stroke="#525252" stroke-width="1.2" marker-end="url(#popup-values-flow-inline-arrow)"/>
  <path d="M380 68 L380 92 Q380 100 388 100 L520 100 Q528 100 528 108 L528 254" fill="none" stroke="#525252" stroke-width="1.2" marker-end="url(#popup-values-flow-inline-arrow)"/>
  <path d="M112 188 L112 254" fill="none" stroke="#525252" stroke-width="1.2" marker-end="url(#popup-values-flow-inline-arrow)"/>
  <rect x="120" y="213" width="76" height="16" rx="2" fill="#f5f5f5"/><text x="158" y="225" fill="#525252" font-size="10" font-weight="600" letter-spacing="0.1em" font-family="inherit" text-anchor="middle">FORMATTED</text>
  <rect x="328" y="160" width="72" height="16" rx="2" fill="#f5f5f5"/><text x="364" y="172" fill="#525252" font-size="10" font-weight="600" letter-spacing="0.1em" font-family="inherit" text-anchor="middle">RAW VALUE</text>
  <rect x="536" y="160" width="72" height="16" rx="2" fill="#f5f5f5"/><text x="572" y="172" fill="#525252" font-size="10" font-weight="600" letter-spacing="0.1em" font-family="inherit" text-anchor="middle">RAW VALUE</text>
  <rect x="200" y="16" width="240" height="52" rx="6" fill="#ffffff" stroke="#171717" stroke-width="1"/><text x="320" y="39" fill="#171717" font-size="14" font-weight="600" font-family="inherit" text-anchor="middle">A clicked feature</text><text x="320" y="57" fill="#525252" font-size="12" font-family="inherit" text-anchor="middle">raw values, such as 12345.6789</text>
  <rect x="16" y="132" width="192" height="56" rx="6" fill="#ffffff" stroke="#171717" stroke-width="1"/><text x="112" y="157" fill="#171717" font-size="14" font-weight="600" font-family="inherit" text-anchor="middle">Format tab</text><text x="112" y="175" fill="#525252" font-size="12" font-family="inherit" text-anchor="middle">the format you set</text>
  <rect x="16" y="256" width="192" height="140" rx="6" fill="#f5f5f5"/><rect x="16" y="256" width="192" height="140" rx="6" fill="rgba(196,54,12,0.08)" stroke="#c4360c" stroke-width="1.4"/><line x1="16" y1="304" x2="208" y2="304" stroke="rgba(23,23,23,0.12)" stroke-width="1"/><text x="32" y="278" fill="#171717" font-size="14" font-weight="600" font-family="inherit" text-anchor="start">Text</text><text x="32" y="295" fill="#525252" font-size="12" font-family="inherit" text-anchor="start">formatted values</text><text x="32" y="324" fill="#171717" font-size="12" font-family="inherit" text-anchor="start">Variables in the editor</text><text x="32" y="344" fill="#171717" font-size="12" font-family="inherit" text-anchor="start">Variables in the Title</text><text x="32" y="364" fill="#171717" font-size="12" font-family="inherit" text-anchor="start">Button text</text><text x="32" y="384" fill="#171717" font-size="12" font-family="inherit" text-anchor="start">Such as 12,345.68</text>
  <rect x="224" y="256" width="192" height="140" rx="6" fill="#f5f5f5"/><rect x="224" y="256" width="192" height="140" rx="6" fill="#ffffff" stroke="#171717" stroke-width="1"/><line x1="224" y1="304" x2="416" y2="304" stroke="rgba(23,23,23,0.12)" stroke-width="1"/><text x="240" y="278" fill="#171717" font-size="14" font-weight="600" font-family="inherit" text-anchor="start">Addresses</text><text x="240" y="295" fill="#525252" font-size="12" font-family="inherit" text-anchor="start">raw values</text><text x="240" y="324" fill="#171717" font-size="12" font-family="inherit" text-anchor="start">Link and button targets</text><text x="240" y="344" fill="#171717" font-size="12" font-family="inherit" text-anchor="start">Image sources</text><text x="240" y="364" fill="#171717" font-size="12" font-family="inherit" text-anchor="start">YouTube and iframe embeds</text><text x="240" y="384" fill="#171717" font-size="12" font-family="inherit" text-anchor="start">Empty value: no embed</text>
  <rect x="432" y="256" width="192" height="140" rx="6" fill="#f5f5f5"/><rect x="432" y="256" width="192" height="140" rx="6" fill="#ffffff" stroke="#171717" stroke-width="1"/><line x1="432" y1="304" x2="624" y2="304" stroke="rgba(23,23,23,0.12)" stroke-width="1"/><text x="448" y="278" fill="#171717" font-size="14" font-weight="600" font-family="inherit" text-anchor="start">Equations</text><text x="448" y="295" fill="#525252" font-size="12" font-family="inherit" text-anchor="start">raw values</text><text x="448" y="324" fill="#171717" font-size="12" font-family="inherit" text-anchor="start">Values used as numbers</text><text x="448" y="344" fill="#171717" font-size="12" font-family="inherit" text-anchor="start">Result rounded to the</text><text x="448" y="364" fill="#171717" font-size="12" font-family="inherit" text-anchor="start">equation’s Decimal Places</text>
</svg>
<svg class="hidden dark:block" style="width: 100%; height: auto" viewBox="0 0 640 412" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="popup-values-flow-inline-dark-title popup-values-flow-inline-dark-desc">
  <title id="popup-values-flow-inline-dark-title">Where a value is formatted</title>
  <desc id="popup-values-flow-inline-dark-desc">Data flow: a clicked feature’s raw values pass through the Format tab only on their way into popup text, the Title and button text; link, button, image and embed addresses use the raw value, an empty value drops an embed, and equations use the raw values as numbers and round the result to their Decimal Places.</desc>
  <defs>
    <marker id="popup-values-flow-inline-dark-arrow" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto"><polygon points="0 0, 8 3, 0 6" fill="#a3a3a3"/></marker>
    <marker id="popup-values-flow-inline-dark-arrow-accent" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto"><polygon points="0 0, 8 3, 0 6" fill="#ff7a4d"/></marker>
  </defs>
  <rect width="100%" height="100%" fill="#141414"/>
  <path d="M260 68 L260 92 Q260 100 252 100 L120 100 Q112 100 112 108 L112 130" fill="none" stroke="#a3a3a3" stroke-width="1.2" marker-end="url(#popup-values-flow-inline-dark-arrow)"/>
  <path d="M320 68 L320 254" fill="none" stroke="#a3a3a3" stroke-width="1.2" marker-end="url(#popup-values-flow-inline-dark-arrow)"/>
  <path d="M380 68 L380 92 Q380 100 388 100 L520 100 Q528 100 528 108 L528 254" fill="none" stroke="#a3a3a3" stroke-width="1.2" marker-end="url(#popup-values-flow-inline-dark-arrow)"/>
  <path d="M112 188 L112 254" fill="none" stroke="#a3a3a3" stroke-width="1.2" marker-end="url(#popup-values-flow-inline-dark-arrow)"/>
  <rect x="120" y="213" width="76" height="16" rx="2" fill="#141414"/><text x="158" y="225" fill="#a3a3a3" font-size="10" font-weight="600" letter-spacing="0.1em" font-family="inherit" text-anchor="middle">FORMATTED</text>
  <rect x="328" y="160" width="72" height="16" rx="2" fill="#141414"/><text x="364" y="172" fill="#a3a3a3" font-size="10" font-weight="600" letter-spacing="0.1em" font-family="inherit" text-anchor="middle">RAW VALUE</text>
  <rect x="536" y="160" width="72" height="16" rx="2" fill="#141414"/><text x="572" y="172" fill="#a3a3a3" font-size="10" font-weight="600" letter-spacing="0.1em" font-family="inherit" text-anchor="middle">RAW VALUE</text>
  <rect x="200" y="16" width="240" height="52" rx="6" fill="#1c1c1c" stroke="#f2f2f2" stroke-width="1"/><text x="320" y="39" fill="#f2f2f2" font-size="14" font-weight="600" font-family="inherit" text-anchor="middle">A clicked feature</text><text x="320" y="57" fill="#a3a3a3" font-size="12" font-family="inherit" text-anchor="middle">raw values, such as 12345.6789</text>
  <rect x="16" y="132" width="192" height="56" rx="6" fill="#1c1c1c" stroke="#f2f2f2" stroke-width="1"/><text x="112" y="157" fill="#f2f2f2" font-size="14" font-weight="600" font-family="inherit" text-anchor="middle">Format tab</text><text x="112" y="175" fill="#a3a3a3" font-size="12" font-family="inherit" text-anchor="middle">the format you set</text>
  <rect x="16" y="256" width="192" height="140" rx="6" fill="#141414"/><rect x="16" y="256" width="192" height="140" rx="6" fill="rgba(255,122,77,0.10)" stroke="#ff7a4d" stroke-width="1.4"/><line x1="16" y1="304" x2="208" y2="304" stroke="rgba(242,242,242,0.14)" stroke-width="1"/><text x="32" y="278" fill="#f2f2f2" font-size="14" font-weight="600" font-family="inherit" text-anchor="start">Text</text><text x="32" y="295" fill="#a3a3a3" font-size="12" font-family="inherit" text-anchor="start">formatted values</text><text x="32" y="324" fill="#f2f2f2" font-size="12" font-family="inherit" text-anchor="start">Variables in the editor</text><text x="32" y="344" fill="#f2f2f2" font-size="12" font-family="inherit" text-anchor="start">Variables in the Title</text><text x="32" y="364" fill="#f2f2f2" font-size="12" font-family="inherit" text-anchor="start">Button text</text><text x="32" y="384" fill="#f2f2f2" font-size="12" font-family="inherit" text-anchor="start">Such as 12,345.68</text>
  <rect x="224" y="256" width="192" height="140" rx="6" fill="#141414"/><rect x="224" y="256" width="192" height="140" rx="6" fill="#1c1c1c" stroke="#f2f2f2" stroke-width="1"/><line x1="224" y1="304" x2="416" y2="304" stroke="rgba(242,242,242,0.14)" stroke-width="1"/><text x="240" y="278" fill="#f2f2f2" font-size="14" font-weight="600" font-family="inherit" text-anchor="start">Addresses</text><text x="240" y="295" fill="#a3a3a3" font-size="12" font-family="inherit" text-anchor="start">raw values</text><text x="240" y="324" fill="#f2f2f2" font-size="12" font-family="inherit" text-anchor="start">Link and button targets</text><text x="240" y="344" fill="#f2f2f2" font-size="12" font-family="inherit" text-anchor="start">Image sources</text><text x="240" y="364" fill="#f2f2f2" font-size="12" font-family="inherit" text-anchor="start">YouTube and iframe embeds</text><text x="240" y="384" fill="#f2f2f2" font-size="12" font-family="inherit" text-anchor="start">Empty value: no embed</text>
  <rect x="432" y="256" width="192" height="140" rx="6" fill="#141414"/><rect x="432" y="256" width="192" height="140" rx="6" fill="#1c1c1c" stroke="#f2f2f2" stroke-width="1"/><line x1="432" y1="304" x2="624" y2="304" stroke="rgba(242,242,242,0.14)" stroke-width="1"/><text x="448" y="278" fill="#f2f2f2" font-size="14" font-weight="600" font-family="inherit" text-anchor="start">Equations</text><text x="448" y="295" fill="#a3a3a3" font-size="12" font-family="inherit" text-anchor="start">raw values</text><text x="448" y="324" fill="#f2f2f2" font-size="12" font-family="inherit" text-anchor="start">Values used as numbers</text><text x="448" y="344" fill="#f2f2f2" font-size="12" font-family="inherit" text-anchor="start">Result rounded to the</text><text x="448" y="364" fill="#f2f2f2" font-size="12" font-family="inherit" text-anchor="start">equation’s Decimal Places</text>
</svg>
{/* /diagram:popup-values-flow */}

Variables work inside attribute strings on other content too:

- **Link URLs** — `https://example.com/{slug}` makes each feature's link target unique. Links use the raw value, not the format from the Format tab. A button's text uses the formatted value, like text in the editor.
- **Email and phone links** — in the `Set link` dialog, `{email}` in `Email address`, `Subject`, or `Body`, and `{phone}` or `{sms}` in `Phone number`. See [How to add an email link to a custom popup](/docs/configuring-popups/add-email-links-to-popup) and [How to add a call or message link to a custom popup](/docs/configuring-popups/add-call-or-message-links-to-popup).
- **Image sources** — `{photo_url}` puts a per-feature image in the popup. Images use the raw value. See [How to add an image to a custom popup](/docs/configuring-popups/add-images-to-popup).
- **Embed addresses** — `https://www.youtube.com/embed/{video_id}` in `Insert YouTube video`, or `https://en.wikipedia.org/wiki/{wikipedia_slug}` in an `Insert iframe` address. Embeds use the raw value. If a variable is empty, the popup leaves that embed out. See [How to embed an iframe in a custom popup](/docs/configuring-popups/embed-iframe-in-popup).
- **Equation expressions** — `{population} / {area}` in the equation editor references attributes inside an inline calculation. Equations use the raw values as numbers, and round the result to the equation's `Decimal Places`. Insert the equation with `Insert equation`. See [How to add a calculated value to a custom popup](/docs/configuring-popups/add-equations-to-popup).

## Mix variables and plain text

A typical popup combines plain text (the labels) with variables (the values):
```text
Population: {population}
Area: {area_km2} km²
Last updated: {last_updated}
```
Plain text renders as-is. Variables substitute per feature. The format on each attribute decides the display — `population` formatted as `Number → Rounded` shows `12,345`; `last_updated` formatted as `Date & Time → Long format` shows `Sat 09 May 2026`.

## What happens when a variable can't resolve

A variable that points at a missing attribute, or to an attribute whose value is empty for the current feature, renders as blank.

If you see a blank value unexpectedly:

- Check that the variable name matches an actual attribute on the layer.
- Check the feature you clicked actually has a value for that attribute. Some features may have empty values where others don't.
- For computed values, check the equation extension — see [How to add a calculated value to a custom popup](/docs/configuring-popups/add-equations-to-popup).

## If you change the format on the Format tab

Format changes take effect immediately in the popup. You don't need to re-save the popup template — variables resolve to the current format every time the popup opens.

## Related

- [How to write a custom popup template](/docs/configuring-popups/write-custom-popup-template)
- [Popup tab controls](/docs/configuring-popups/popup-reference)
- [How popups work in MangoMap](/docs/configuring-popups/concepts-popups)
- [Attribute format controls](/docs/formatting-attributes/attribute-format-reference)
- [How to add a calculated value to a custom popup](/docs/configuring-popups/add-equations-to-popup)
