Skip to content

Legend

Shows symbology swatches for the currently visible layers — single-color swatches, category lists, and gradient bars, with the right swatch shape per geometry (dot / line / square).

  • id: legend
  • Surfaces: left-panel

Place it

leftPanelWidgets: [{ widgetName: 'legend' }],

Behavior

  • Renders only layers that are visible and have kit symbology. Raster layers (ArcGIS dynamic/tiled) and Esri vector layers using the service's own renderer are skipped — there's nothing introspectable to draw.
  • Single-color layers (simple symbology) get one swatch shaped by geometryType.
  • Categorized / graduated layers (raw symbology with match / interpolate expressions) are auto-introspected into a category list or a gradient bar.
  • A layer's symbology.description renders as a muted subtitle under its name (e.g. "Annual passengers").
  • Sort order: raw symbologies first, then point → line → polygon, stable within each group.

Controlling what shows

  • Provide an explicit legend override on raw symbology when auto-introspection can't read your paint.
  • Hide a layer from the legend (while keeping it on the map) with hideFromLegend: true — works for any symbology kind.

The legend has no settings.ts config block of its own; it derives everything from your layers' symbology.