Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <!DOCTYPE html>

  <meta charset="utf-8" />
  <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
  <title>Intro to popups | Sample | ArcGIS API for JavaScript 4.16</title>

  <link rel="stylesheet" href="" />
  <link rel="stylesheet" type="text/css" href="">
  <script src=""></script>
  <script src="" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
  <script src=""></script>


  <div id="viewDiv"></div>
  <div id="instruction" class="esri-widget">
    Click any location on the map to see its street address



#viewDiv {
  padding: 0;
  margin: 0;
  height: 100%;
  width: 100%;

#instruction {
  z-index: 99;
  position: absolute;
  top: 15px;
  left: 50%;
  padding: 5px;
  margin-left: -175px;
  height: 30px;
  width: 355px;
  background: rgba(25, 25, 25, 0.8);
  color: white;


                require(["esri/tasks/Locator", "esri/Map", "esri/views/MapView"], function (
) {
  // Set up a locator task using the world geocoding service
  var locatorTask = new Locator({
    url: ""
  // Create the Map
  var map = new Map({
    basemap: "streets-navigation-vector"
  // Create the MapView
  var view = new MapView({
    container: "viewDiv",
    map: map,
    center: [-71.6899, 43.7598],
    zoom: 12

  // Renders when the popup template content is updated
    (newValue, oldValue, propertyName, target) => {
      // console.log(newValue, oldValue, propertyName, target);
      setTimeout(() => {
        // Initialize the Semantic UI Tabs
        $(".esri-popup__content").find(".menu .item").tab();
      }, 500);

   * This click event sets generic content on the popup not tied to
   * a layer, graphic, or popupTemplate. The location of the point is
   * used as input to a reverse geocode method and the resulting
   * address is printed to the popup content.
  view.popup.autoOpenEnabled = false;
  view.on("click", function (event) {
    // Get the coordinates of the click on the view
    var lat = Math.round(event.mapPoint.latitude * 1000) / 1000;
    var lon = Math.round(event.mapPoint.longitude * 1000) / 1000;{
      // Set the popup's title to the coordinates of the location
      title: "Reverse geocode: [" + lon + ", " + lat + "]",
      location: event.mapPoint // Set the location of the popup to the clicked location
    var params = {
      location: event.mapPoint
    // Display the popup
    // Execute a reverse geocode using the clicked location
      .then(function (response) {
        // If an address is successfully found, show it in the popup's content
        view.popup.content = `
          <div class="ui fluid two item secondary pointing menu">
            <a class="active item" data-tab="tab_a">Tab A</a>
            <a class="item" data-tab="tab_b">Tab B</a>

          <div class="ui active tab" data-tab="tab_a">Tab A</div>
          <div class="ui tab" data-tab="tab_b">Tab B</div>
      .catch(function (error) {
        // If the promise fails and no result is found, show a generic message
        view.popup.content = "something went wrong";