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 featurefilter-attributes sample,
     read the original sample description at
      Filter features by attribute | Sample | ArcGIS API for JavaScript 4.19

    <script src=""></script>

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

      #seasons-filter {
        height: 160px;
        width: 160px;
        visibility: hidden;

      .season-item {
        width: 100%;
        padding: 12px;
        text-align: center;
        vertical-align: baseline;
        cursor: pointer;
        height: 40px;

      .season-item:focus {
        background-color: dimgrey;

      .season-item:hover {
        background-color: dimgrey;

      #titleDiv {
        padding: 10px;

      #titleText {
        font-size: 20pt;
        font-weight: 60;
        padding-bottom: 10px;
      ], (MapView, Map, GeoJSONLayer, Expand) => {
        let floodLayerView;

        const url =

        const template = {
          title: "Earthquake Info",
          content: "Magnitude {mag} {type} hit {place} on {time}",
          fieldInfos: [
              fieldName: "time",
              format: {
                dateFormat: "short-date-short-time"

        const renderer = {
          type: "simple",
          field: "mag",
          symbol: {
            type: "simple-marker",
            color: "orange",
            outline: {
              color: "white"
          visualVariables: [
              type: "size",
              field: "mag",
              stops: [
                  value: 2.5,
                  size: "4px"
                  value: 8,
                  size: "40px"

        const geojsonLayer = new GeoJSONLayer({
          url: url,
          copyright: "USGS Earthquakes",
          popupTemplate: template,
          renderer: renderer //optional

        const map = new Map({
          basemap: "gray-vector",
          layers: [geojsonLayer]

        const view = new MapView({
          container: "viewDiv",
          center: [-168, 46],
          zoom: 2,
          map: map

        const seasonsNodes = document.querySelectorAll(`.season-item`);
        const seasonsElement = document.getElementById("seasons-filter");

        // click event handler for seasons choices
        seasonsElement.addEventListener("click", filterBySeason);

        // User clicked on Winter, Spring, Summer or Fall
        // set an attribute filter on flood warnings layer view
        // to display the warnings issued in that season
        function filterBySeason(event) {
          const selectedSeason = parseInt(
          floodLayerView.filter = {
            where: `mag >= ${selectedSeason}`

        view.whenLayerView(geojsonLayer).then((layerView) => {
          // flash flood warnings layer loaded
          // get a reference to the flood warnings layerview
          floodLayerView = layerView;

          // set up UI items
 = "visible";
          const seasonsExpand = new Expand({
            view: view,
            content: seasonsElement,
            expandIconClass: "esri-icon-filter",
            group: "top-left"
          //clear the filters when user closes the expand widget
"expanded", () => {
            if (!seasonsExpand.expanded) {
              floodLayerView.filter = null;
          view.ui.add(seasonsExpand, "top-left");
          view.ui.add("titleDiv", "top-right");

    <div id="seasons-filter" class="esri-widget">
      <div class="season-item visible-season" data-season="3">
        greater than 3
      <div class="season-item visible-season" data-season="4">
        greater than 4
      <div class="season-item visible-season" data-season="5">
        greater than 5
      <div class="season-item visible-season" data-season="6">
        greater than 6
    <div id="viewDiv"></div>
    <div id="titleDiv" class="esri-widget">
      <div id="titleText">Flash Floods by Season</div>
      <div>Flash Flood Warnings (2002 - 2012)</div>