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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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.


                <!-- demonstrate a simpler way to add a button which behaves like an ArcGIS widget, without the rigmarole of creating a proper widget at>

  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
  <title>Create a simple ArcGIS widget</title>
  <link rel="stylesheet" href="">
  <script src=""></script>
  <script src=""></script>

<body class="calcite">
  <div id="viewDiv"></div>


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


        MapView, Legend, LayerList, WebMap
        ) {

  var webmap = new WebMap({
    portalItem: { // autocasts as new PortalItem()
      id: "4abe6a830b8f466dacf8abfde567a781"

  var view = new MapView({
    container: "viewDiv",
    map: webmap

  view.when(function() {
    var featureLayer = webmap.layers.getItemAt(0);

    var legend = new Legend({
      view: view,
      layerInfos: [{
        layer: featureLayer,
        title: "NY Educational Attainment"

    var layerList = new LayerList({
      view: view

    // Add the Esri widgets
    view.ui.add(legend, "bottom-right");
    view.ui.add(layerList, "top-right");

    // Add a button styled to look like an Esri widget
    // see for the list of available icons
    var btnHtml = '<div class="esri-component esri-widget">';
    btnHtml += '<div id="btnCustom" class="esri-widget--button esri-widget esri-interactive" role="button" title="My Custom Button">';
    btnHtml += '<span aria-hidden="true" role="presentation" class="esri-icon esri-icon-map-pin"></span>';
    btnHtml += '<span class="esri-icon-font-fallback-text">Custom Button</span></div></div>';
    // Place the button into the top-left widget section, after the zoom controls

    // Do standard JavaScript stuff with the button
      alert("Clicked the custom button");