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.


    <meta charset="utf-8" />
  ArcGIS API for JavaScript,
  For more information about the layers-mapimagelayer sample, read the original sample description at
      Example for BUG-000131005

    <script src=""></script>

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

      ], function (Map, MapView, GroupLayer, FeatureLayer, Legend, LayerList) {
        var gacc = new FeatureLayer({
          title: 'GACC',
          url: '',
          visible: true,
        var dispatch = new FeatureLayer({
          title: 'Dispatch Center Boundaries',
          url: '',
          visible: true,
        var subGrpLayer = new GroupLayer({
          title: "2nd Group",
          layers: [gacc, dispatch]
        var grpLayer = new GroupLayer({
          title: "1st Group",
          layers: [subGrpLayer]

         * Add the layer to a map
        var map = new Map({
          basemap: "dark-gray-vector",
          //layers: [bpsLayer, mtbsLayer]
          layers: [grpLayer]

        var view = new MapView({
          container: "viewDiv",
          map: map,
          center: [-102, 40],
          zoom: 4,          
        // Add layer list widget
        const layerListWidget = new LayerList({
          view: view,
          selectionEnabled: true,
          // this will add the legend into the layer list
          listItemCreatedFunction: layerListItems,
        layerListWidget.on('trigger-action', this.layerListTranparency);
        view.ui.add(layerListWidget, "bottom-right");
        function layerListItems(event) {
          // Get the item in the layerlist
          const item = event.item;
          // don't show legend twice
          if (item.layer.type !== 'group') {
            item.panel = {
              content: 'legend',
              open: item.visible,
            item.actionsSections = [
                  title: 'Increase transparency',
                  className: 'esri-icon-up',
                  id: 'increase-transparency'
                  title: 'Decrease transparency',
                  className: 'esri-icon-down',
                  id: 'decrease-transparency'

    <div id="viewDiv"></div>