leaf <- leaflet() %>%
addTiles() %>%
addEasyButton(easyButton(
icon = htmltools::span(class = "star", htmltools::HTML("★")),
onClick = JS("function(btn, map){ map.setZoom(1);}")))
leaf
leaf <- leaflet() %>%
addTiles() %>%
addEasyButtonBar(
easyButton(
icon = htmltools::span(class = "star", htmltools::HTML("★")),
onClick = JS("function(btn, map){ alert(\"Button 1\");}")),
easyButton(
icon = htmltools::span(class = "star", htmltools::HTML("⌖")),
onClick = JS("function(btn, map){ alert(\"Button 2\");}")))
leaf
Run the code above in your browser using DataLab