Skip to contents

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,
  options = list(container = "sidebar", position = "left", fit = TRUE)
)

Arguments

map

A leaflet map widget

options

A named list with position and fit elements.

id

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

Value

the new map object

See also

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

Examples

if (FALSE) { # \dontrun{
library(shiny)
runApp(paste0(
  system.file('examples', package = 'leaflet.extras2'),
  '/sidebar_app.R'
))
} # }