addSidebar: Add a Sidebar Leaflet Control

View source: R/sidebar.R

addSidebarR Documentation

Add a Sidebar Leaflet Control

Description

The sidebar HTML must be created with sidebar_tabs and sidebar_pane before leafletOutput is called.

Usage

addSidebar(map, id = "sidebar", options = list(position = "left"), ns = NULL)

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 the only option position, which should be either left or right.

ns

The namespace function, if used in Shiny modules.

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

## Not run: 
library(shiny)

# run example app showing a single sidebar
runApp(paste0(
  system.file("examples", package = "leaflet.extras2"),
  "/sidebar_app.R"
))

# run example app showing two sidebars
runApp(paste0(
  system.file("examples", package = "leaflet.extras2"),
  "/multi_sidebar_app.R"
))

## End(Not run)

leaflet.extras2 documentation built on April 3, 2025, 10:46 p.m.