This bundle provides a widget that displays labels and symbols for layers that are visible in the map.


No configuration is required. Default values are applied.

The widget is registered at the component system with the widget role legend.

Exclude layers from the legend

To exclude specific layers from the legend, set the property legendEnabled of the according layer to false in the map-init bundle.


For a list of supported layer types and constraints, see the ArcGIS Maps SDK for JavaScript documentation.

Configuration reference

The following code sample shows all configurable properties and their default values:

"legend": {
    "Config": {
        "headingLevel": 3,
        "hideLayersNotInCurrentView": false,
        "respectLayerVisibility": true,
        "showBasemaps": false,
        "styleType": "classic"
Property Type Description
headingLevel Number Specifies the heading level used by the legend title.
hideLayersNotInCurrentView Boolean To only display those layers in the legend that are currently visible in the view, set this value to true.
respectLayerVisibility Boolean To always display legend entries regardless of whether the associated layer is enabled or not, set this value to false.
showBasemaps Boolean To display base map layers in the legend, set this property to true.
styleType String To display the legend in a card style, set this property to "card" instead of "classic", which is the default.
styleLayout String This property is only applicable if styleType is set to card. To display legend cards for each layer stacked (only one visible at a time), set this property to stack. To display the cards side-by-side, set the property to side-by-side.