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.

Generated from the component's definition in the library, so it always matches the version this demo runs.

Attribute Type Default Description
id required string — Unique identifier for the switcher; it also names what remember keeps.
map_id required string — ID of the map to put the switcher on.
position string "top-right" The corner of the map: "top-left", "top-right", "bottom-left" or "bottom-right". Defaults to "top-right". A new value moves the switcher to that corner.
label string "Layers" The accessible name and tooltip of the button. Defaults to "Layers".
base_label string "Base map" The heading of the bases, which names their group of radio buttons, as the heading of a group of overlays names it. Defaults to "Base map".
open boolean false Whether the panel starts open. Defaults to false.
remember boolean false Whether to keep the user's choice in the browser and give it back on the next visit (see "Remembering the choice" above). Defaults to false.
events any [] a list of event names, or :all
global attributes global — Any other HTML attribute, passed on to the component's element.

Slots

  • base Optional.
  • overlay Optional.