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 is required to process package imports. If you need a different preprocessor remove all packages first.

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


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 name="description" content="DevLab: Style a feature layer">
  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
  <title>ArcGIS API for JavaScript Tutorials: Style a feature layer</title>
    #viewDiv {
      padding: 0;
      margin: 0;
      height: 100%;
      width: 100%;
  <link rel="stylesheet" href="">
  <script src=""></script>

    ) {

      var map = new Map({
        basemap: "topo-vector"

      var view = new MapView({
        container: "viewDiv",
        map: map,
        center: [-118.80543,34.02700],
        zoom: 13

      // Define a simple renderer and an image symbol
      var trailheadsRenderer = {
        "type": "simple",
        "symbol": {
          "type": "picture-marker",
          "url": "",
          "width": "18px",
          "height": "18px"
      // Add labels
      var trailheadsLabels = {
        symbol: {
          type: "text",
          color: "#FFFFFF",
          haloColor: "#5E8D74",
          haloSize: "2px",
          font: {
            size: "12px",
            family: "Noto Sans",
            style: "italic",
            weight: "normal"
        labelPlacement: "above-center",
        labelExpressionInfo: {
          expression: "$feature.TRL_NAME"

      // Create the layer and set the renderer
      var trailheads = new FeatureLayer({
        url: "",
        renderer: trailheadsRenderer,
        labelingInfo: [trailheadsLabels]
      // Add the layer
      // Define a unique value renderer and symbols
      var trailsRenderer = {
        type: "simple",
        symbol: {
          color: "#BA55D3",
          type: "simple-line",
          style: "solid"
        visualVariables: [
            type: "size",
            field: "ELEV_GAIN",
            minDataValue: 0,
            maxDataValue: 2300,
            minSize: "3px",
            maxSize: "7px"
      // Create the layer and set the renderer
      var trails = new FeatureLayer({
        url: "",
        renderer: trailsRenderer,
        opacity: .75
      // Add the layer
      // Add bikes only trails
      var bikeTrailsRenderer = {
        type: "simple",
        symbol: {
          type: "simple-line",
          style: "short-dot",
          color: "#FF91FF",
          width: "1px"
      var bikeTrails = new FeatureLayer({
        renderer: bikeTrailsRenderer,
        definitionExpression: "USE_BIKE = 'YES'"

      map.add(bikeTrails, 1);
      // Add parks with a class breaks renderer and unique symbols
      function createFillSymbol(value, color) {
        return {
          "value": value,
          "symbol": {
            "color": color,
            "type": "simple-fill",
            "style": "solid",
            "outline": {
              "style": "none"
          "label": value

      var openSpacesRenderer = {
        type: "unique-value",
        field: "TYPE",
        uniqueValueInfos: [
          createFillSymbol("Natural Areas", "#9E559C"),
          createFillSymbol("Regional Open Space", "#A7C636"),
          createFillSymbol("Local Park", "#149ECE"),
          createFillSymbol("Regional Recreation Park", "#ED5151")
      // Create the layer and set the renderer
      var openspaces = new FeatureLayer({
        url: "",
        renderer: openSpacesRenderer,
        opacity: 0.2
      // Add the layer


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