Layer Toggle control
The Layer Toggle (labelled Toggle in the config panel) is a custom, pill-style control that flips the visibility of a curated set of the WebMap's layers without opening the full layer list.
What it does
Renders one pill per configured layer. Activating a pill shows its layer and hides the others, letting a viewer reveal one layer at a time. It is meant for focused "switch between these layers" experiences rather than full layer management.
Configuration
| Field | Type | Default | Purpose |
|---|---|---|---|
layerToggle.placement | ControlPlacement | null | null | Corner placement, or null to hide. |
layerToggle.options | LayerToggleOption[] (max 8) | [] | Layers the viewer can toggle. |
Each LayerToggleOption is { layerId, label }, referencing an operational
layer id within the loaded WebMap.
In the config panel
- Open Appearance → UI controls and drag the Toggle chip onto a corner (or into a corner's expand).
- Once placed, a Layers to toggle editor appears. Add up to eight layers from the loaded WebMap and label each. A WebMap must be loaded so its layers are available to reference.
Behavior
- Requires at least one configured layer; with none added the control does nothing.
- When enabled it shows the first layer (its pill active) and hides the rest.
- Removing the toggle reinstates each layer's default visibility by reading it back from the source WebMap item via the SDK—no layer state is stored locally—so dynamic layer changes are respected.
Related
- For full layer management (all layers, group layers, legend swatches), use the Layer List.