I'm building a web app using ESRI's ArcGIS API for Javascript 4.8. I have a legend and a layer list widget on the page. The legend displays the symbology used but lacks ability to toggle display of the feature. The layer list allows toggling display of the feature but lacks the symbology (e.g., what does that red circle represent?)

Is there a widget that combines the visibility toggle and symbology so I have one widget on the page?

Or do I need to create custom widget for this?

Any other options before I start down the path of building a custom widget?


You have a sample here

// Add a legend instance to the panel of a
// ListItem in a LayerList instance
const layerList = new LayerList({
  view: view,
  listItemCreatedFunction: function (event) {
    const item = event.item;
    item.panel = {
      content: "legend",
      open: true
view.ui.add(layerList, "top-right");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.