Learn R Programming

leaflet.extras2 (version 1.0.0)

addSidebar: Add a Sidebar Leaflet Control

Description

The sidebar plugin only works in a reactive environment (e.g Shiny), as the HTML must be created by using sidebar_tabs and sidebar_pane and it must be created before leafletOutput.

Usage

addSidebar(map, id = "sidebar", options = list(position = "left", fit = TRUE))

Arguments

map

A leaflet map widget

id

Id of the sidebar-div. Must match with the id of sidebar_tabs

options

A named list with position and fit elements.

Value

the new map object

References

https://github.com/Turbo87/sidebar-v2

See Also

Other Sidebar Functions: closeSidebar(), openSidebar(), removeSidebar(), sidebar_pane(), sidebar_tabs()

Examples

Run this code
# NOT RUN {
library(shiny)
runApp(paste0(system.file("examples", package = "leaflet.extras2"),
              "/sidebar_app.R"))
# }

Run the code above in your browser using DataLab