% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/groupedlayercontrol.R
\name{addGroupedLayersControl}
\alias{addGroupedLayersControl}
\title{Leaflet layer control with support for grouping overlays together.}
\usage{
addGroupedLayersControl(
  map,
  baseGroups = character(0),
  overlayGroups = character(0),
  position = c("topright", "bottomright", "bottomleft", "topleft"),
  options = groupedLayersControlOptions()
)
}
\arguments{
\item{map}{the map to add the layers control to}

\item{baseGroups}{character vector where each element is the name of a group.
The user will be able to choose one base group (only) at a time. This is
most commonly used for mostly-opaque tile layers.}

\item{overlayGroups}{A list of named vectors where each element is the name
of a group.}

\item{position}{position of control: "topleft", "topright", "bottomleft", or
"bottomright"}

\item{options}{a list of additional options, intended to be provided by a
call to \code{\link{groupedLayersControlOptions}}}
}
\description{
Also supports making groups exclusive (using radio inputs instead of checkbox).
See the JavaScript plugin for more information
\url{https://github.com/trafficonese/leaflet-groupedlayercontrol/}
}
\examples{
library(leaflet)
library(leaflet.extras)

leaflet() \%>\%
  addTiles(group = "OpenStreetMap") \%>\%
  addProviderTiles("CartoDB", group = "CartoDB") \%>\%
  addCircleMarkers(runif(20, -75, -74), runif(20, 41, 42),
    color = "red", group = "Markers2"
  ) \%>\%
  addCircleMarkers(runif(20, -75, -74), runif(20, 41, 42),
    color = "green", group = "Markers1"
  ) \%>\%
  addCircleMarkers(runif(20, -75, -74), runif(20, 41, 42),
    color = "yellow", group = "Markers3"
  ) \%>\%
  addCircleMarkers(runif(20, -75, -74), runif(20, 41, 42),
    color = "lightblue", group = "Markers4"
  ) \%>\%
  addCircleMarkers(runif(20, -75, -74), runif(20, 41, 42),
    color = "purple", group = "Markers5"
  ) \%>\%
  addGroupedLayersControl(
    baseGroups = c("OpenStreetMap", "CartoDB"),
    overlayGroups = list(
      "Layergroup_2" = c("Markers5", "Markers4"),
      "Layergroup_1" = c("Markers2", "Markers1", "Markers3")
    ),
    position = "topright",
    options = groupedLayersControlOptions(
      groupCheckboxes = TRUE,
      collapsed = FALSE,
      groupsCollapsable = TRUE,
      sortLayers = FALSE,
      sortGroups = FALSE,
      sortBaseLayers = FALSE,
      exclusiveGroups = "Layergroup_1"
    )
  )
}
\seealso{
Other GroupedLayersControl: 
\code{\link{addGroupedOverlay}()},
\code{\link{groupedLayersControlOptions}()}
}
\concept{GroupedLayersControl}
