Skip to content

layer_switcher

Stable

A button in a corner of the map that opens a panel to choose the base map and turn overlays on and off.

The events this component sends to the LiveView, as the library documents them. Each arrives in handle_event/3. Use the preview; the last payload of each event the example receives appears here. A component sends only the events its events attribute names, so the example receives those its LiveView handles.

  • layer_switcher:base_changed

    the user chose a base: %{"switcher_id" => id, "key" => key}, with "style" too when the base's style is a URL.

    Not received yet.

  • layer_switcher:overlay_toggled

    the user turned an overlay on or off, by its checkbox or its group's: %{"switcher_id" => id, "key" => key, "layers" => layers, "visible" => visible}, one for each overlay that changed.

    Not received yet.