Skip To ContentArcGIS for DevelopersSign In Dashboard
require(["esri/smartMapping/popup/templates"], function(popupTemplateCreator) { /* code goes here */ });
Object: esri/smartMapping/popup/templates
Since: ArcGIS API for JavaScript 4.16

This object contains helper methods for generating popup templates to be set on a layer. The suggested popup templates will only include information in the popup related to the layer's renderer. For example, the popup template in the image below was generated based on a layer rendered with a predominance renderer coloring census tracks based on the decade in which the most homes were built.

This provides a better default popup template than the traditional approach of providing a long table of unformatted values.

Suggested default template based on rendererTraditional default

Method Overview

NameReturn TypeSummaryObject

Returns one or more suggested popupTemplates for a given layer based on its renderer.

more details
more detailstemplates

Method Details


Returns one or more suggested popupTemplates for a given layer based on its renderer. This method is useful in apps where a layer's renderer can be modified by the user (or some other process) and the popup template is expected to display values related to the renderer. Popup templates will not be generated for layers with renderers that don't refer to a data value (i.e. SimpleRenderer with no visual variables).

params Object

See the table below for details of each parameter that may be passed to this function.


The layer to which the suggested popup templates can be applied.

renderer Renderer

Specify the renderer to be used on the layer when if it will be different than the renderer already set on the layer.

Promise<Templates>Returns an object containing suggested primary and secondary PopupTemplates for the input layer.
// Sets a suggested popupTemplate on the layer based on its renderer
  layer: featureLayer,
  renderer: featureLayer.renderer
  if ( popupTemplateResponse.primaryTemplate ){
    featureLayer.popupTemplate = popupTemplateResponse.primaryTemplate.value;

Type Definitions


Defines a suggested PopupTemplate with a given name and title describing the content and purpose of the PopupTemplate.

name String

The name of the auto-generated PopupTemplate. This can be used in the UI of web map authoring apps.

title String

The title of the PopupTemplate.

The suggested PopupTemplate.


The return object of the getTemplates() method.

primaryTemplate Template

Includes the primary PopupTemplate suggested for the input layer.

secondaryTemplates Template[]

Includes secondary PopupTemplates that may be applied to the input layer.

API Reference search results