
Add a visibility toggle control to the map or control panel
Source:R/layer_controls.R
add_visibility_toggle.RdCreates a toggle button that can show/hide a specific layer.
Usage
add_visibility_toggle(
map,
layer_id,
control_id = NULL,
left_label = "Toggle Layer",
right_label = NULL,
initial_state = TRUE,
position = "top-right",
panel_id = NULL,
section_title = NULL,
group_id = NULL
)Arguments
- map
The map or map proxy object.
- layer_id
ID of the layer to toggle visibility for.
- control_id
ID for the control. If
NULL, defaults to "visibility-toggle-<layer_id>".- left_label
Label text for the toggle button. Default is "Toggle Layer".
- right_label
Label text for the toggle button when layer is hidden. Default is "Layer Hidden".
- initial_state
Initial visibility state. Default is
TRUE.- position
Position on the map if not using a control panel. Default is "top-right".
- panel_id
ID of control panel to add to (optional).
- section_title
Section title when added to a control panel.
- group_id
ID of control group to add to (optional).