arcgis-popup-templates
Skill1 starsChanged 6 months agoMITView on GitHub
Configure popups with PopupTemplate in the ArcGIS Maps SDK for JavaScript 5.1: title and content templating with field placeholders, fieldInfos with formatting (digit separators, dates and the view's time zone), media and chart content, and content functions (which need template.outFields). Use this skill whenever the user customizes what appears when a feature is clicked, formats popup fields, or builds custom popup content.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- GeoDaoyu/arcgis-maps-sdk-js-ai-contexttheir own version, first seen Nov 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- GeoDaoyu/arcgis-maps-sdk-js-ai-context★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository73 other files it gives its agents.
- skills/arcgis-3d-layers/AGENTS.mdAGENTS.md
- skills/arcgis-advanced-layers/AGENTS.mdAGENTS.md
- skills/arcgis-ai-components/AGENTS.mdAGENTS.md
- skills/arcgis-arcade/AGENTS.mdAGENTS.md
- skills/arcgis-authentication/AGENTS.mdAGENTS.md
- skills/arcgis-charts/AGENTS.mdAGENTS.md
- skills/arcgis-cim-symbols/AGENTS.mdAGENTS.md
- skills/arcgis-coding-components/AGENTS.mdAGENTS.md
- skills/arcgis-coordinates-projection/AGENTS.mdAGENTS.md
- skills/arcgis-core-maps/AGENTS.mdAGENTS.md
- skills/arcgis-core-utilities/AGENTS.mdAGENTS.md
- skills/arcgis-custom-rendering/AGENTS.mdAGENTS.md
- skills/arcgis-editing/AGENTS.mdAGENTS.md
- skills/arcgis-embeddable-maps/AGENTS.mdAGENTS.md
- skills/arcgis-feature-effects/AGENTS.mdAGENTS.md
- skills/arcgis-geometry-operations/AGENTS.mdAGENTS.md
- skills/arcgis-imagery/AGENTS.mdAGENTS.md
- skills/arcgis-interaction/AGENTS.mdAGENTS.md
- skills/arcgis-knowledge-graphs/AGENTS.mdAGENTS.md
- skills/arcgis-layers/AGENTS.mdAGENTS.md
- skills/arcgis-map-tools/AGENTS.mdAGENTS.md
- skills/arcgis-parquet/AGENTS.mdAGENTS.md
- skills/arcgis-performance/AGENTS.mdAGENTS.md
- skills/arcgis-popup-templates/AGENTS.mdAGENTS.md
- skills/arcgis-portal-content/AGENTS.mdAGENTS.md
- skills/arcgis-rest-services/AGENTS.mdAGENTS.md
- skills/arcgis-scene-environment/AGENTS.mdAGENTS.md
- skills/arcgis-smart-mapping/AGENTS.mdAGENTS.md
- skills/arcgis-spatial-analysis/AGENTS.mdAGENTS.md
- skills/arcgis-starter-app/AGENTS.mdAGENTS.md
- skills/arcgis-tables-forms/AGENTS.mdAGENTS.md
- skills/arcgis-time-animation/AGENTS.mdAGENTS.md
- skills/arcgis-utility-networks/AGENTS.mdAGENTS.md
- skills/arcgis-visualization/AGENTS.mdAGENTS.md
- skills/arcgis-widgets-advanced/AGENTS.mdAGENTS.md
- skills/arcgis-widgets-ui/AGENTS.mdAGENTS.md
- skills/hello-world/AGENTS.mdAGENTS.md
- arcgis-3d-layersSkill
- arcgis-advanced-layersSkill
- arcgis-ai-componentsSkill
- arcgis-arcadeSkill
- arcgis-authenticationSkill
- arcgis-chartsSkill
- arcgis-cim-symbolsSkill
- arcgis-coding-componentsSkill
- arcgis-coordinates-projectionSkill
- arcgis-core-mapsSkill
- arcgis-core-utilitiesSkill
- arcgis-custom-renderingSkill
- arcgis-editingSkill
- arcgis-embeddable-mapsSkill
- arcgis-feature-effectsSkill
- arcgis-geometry-operationsSkill
- arcgis-imagerySkill
- arcgis-interactionSkill
- arcgis-knowledge-graphsSkill
- arcgis-layersSkill
- arcgis-map-toolsSkill
- arcgis-parquetSkill
- arcgis-performanceSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 194
All three old top pitfalls were false or overstated: placeholders are case-insensitive.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Popup Templates
When to use: Activate this skill whenever the user customizes popup title/content, formats fields, or builds custom HTML shown when a feature is clicked.
Overview
A PopupTemplate declares what a layer's popup shows: a title, content blocks, and field formatting.
- Problem it solves: turning raw attributes into a readable, correctly formatted popup.
- Who it serves: developers presenting feature details on click.
- Pattern it teaches: placeholder templating + content blocks; functions only for bespoke layouts.
- What it does NOT cover: the click plumbing (see
arcgis-interaction) or editing (seearcgis-editing).
Quick Start
import PopupTemplate from "@arcgis/core/PopupTemplate.js";
layer.popupTemplate = new PopupTemplate({
title: "{NAME}",
content: [{
type: "fields",
fieldInfos: [
{ fieldName: "POP", label: "Population", format: { digitSeparator: true, places: 0 } },
{ fieldName: "CREATED", label: "Created", format: { dateFormat: "short-date" } },
],
}],
});
view.timeZone = "UTC"; // if your dates are stored as UTC midnights (see Pitfall 2)Measured with 5.1.27: without digitSeparator, 7900000 shows as 7900000; with it, 7.900.000 in an es locale.
Decision Tree
- Just fields and a title?
- Yes → string
title+ afieldscontent block. Placeholders fetch their own fields.
- Yes → string
- Need formatting (separators, dates, decimals)?
- Yes →
fieldInfos[].format; for dates also decide the time zone (view.timeZone).
- Yes →
- Need bespoke HTML?
- Yes → a
contentfunction returning an element, plusoutFieldson the template for every field it reads.
- Yes → a
Default: declarative fields content; reach for a function only for custom HTML.
Import Patterns
Direct ESM (recommended for npm/Vite/Webpack)
import PopupTemplate from "@arcgis/core/PopupTemplate.js";Dynamic Imports (CDN)
const PopupTemplate = await $arcgis.import("@arcgis/core/PopupTemplate.js");Map Components (recommended for new projects)
// Set layer.popupTemplate; the arcgis-map component renders it in arcgis-popup.
import "@arcgis/map-components/components/arcgis-map";Key Concepts
Concept 1: Placeholders fetch their own fields
title and text content take {FIELD} placeholders. Measured: they are case-insensitive ({Name} and {name}
both showed Bogotá for a NAME field), an unknown field renders as empty, and on a service layer with
outFields: ["areaname"] a {pop2000} placeholder still showed 8008278: the popup requested the field when it
opened, even though the hit-test graphic only carried areaname and objectid.
Concept 2: Content blocks
content can be an array of blocks: fields (table), media (charts/images), text (HTML with placeholders),
attachments, expression (Arcade) and relationship. They render top to bottom.
Concept 3: Content functions
content may be a function ({ graphic }) => HTMLElement | string | Promise<...> (measured: the argument had only
graphic; an async function rendered fine). The SDK cannot see which fields a function reads, so it does not fetch
them: list them in the template's outFields. Strings returned from functions and text content are sanitized:
measured, <img onerror> and <script> were stripped and nothing ran, while harmless tags such as <b> were kept,
even when they came from an attribute value.
Common Pitfalls (Top 3)
Pitfall 1: A content function reading a field nobody requested
// ❌ Anti-pattern
new FeatureLayer({ url, outFields: ["areaname"], popupTemplate: new PopupTemplate({
content: (f: { graphic: Graphic }) => `Population: ${f.graphic.attributes.pop2000}`,
}) });// ✅ Correct
new PopupTemplate({
outFields: ["pop2000"],
content: (f: { graphic: Graphic }) => `Population: ${f.graphic.attributes.pop2000}`,
});Impact: measured on a public service: Population: undefined; with outFields: ["pop2000"] on the template,
8008278. Declarative placeholders do not have this problem.
Pitfall 2: Dates that show the previous day
// ❌ Anti-pattern
{ fieldName: "CREATED", format: { dateFormat: "short-date" } } // stored as 2026-10-27T00:00Z// ✅ Correct
view.timeZone = "UTC"; // or the zone the data was captured inImpact: measured in America/Bogota: the default view.timeZone is "system", so a UTC midnight on 27/10/2026
showed 26/10/2026, 7:00 p. m. (and 26/10/2026 with short-date). With view.timeZone = "UTC": 27/10/2026.
Pitfall 3: Expecting thousands separators by default
// ❌ Anti-pattern
{ fieldName: "POP", label: "Population" } // shows 7900000// ✅ Correct
const popInfo = { fieldName: "POP", label: "Population", format: { digitSeparator: true, places: 0 } };Impact: measured: 7900000 without a format, 7.900.000 with digitSeparator: true (es locale).
When to Read references/
| If you need... | Read |
| PopupTemplate / content signatures | references/api-detail.md |
| Fields / media / custom examples | references/examples.md |
| More pitfalls (5+ extended) | references/pitfalls.md |
Related Skills
arcgis-interaction— the click that opens the popuparcgis-layers— setoutFieldsthe popup needsarcgis-arcade— expressions for popup content
Reference Samples
Changelog
- 0.2.0 (2026-10-27): SDK 5.1. Measured by opening real popups in
tests/runtime/casos/arcgis-popup-templates.ts. All three old top pitfalls were false or overstated: placeholders are case-insensitive; the popup fetches the fields its placeholders use even if the layer'soutFieldslack them; and string HTML is sanitized (no script ran). New top pitfalls, measured: content functions do needtemplate.outFields(undefinedwithout it), UTC dates show the previous day under the defaultview.timeZone"system", and numbers have no separators by default. Fixed two extended pitfalls that did not compile. - 0.1.0 (2026-05-31): Initial release.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

