Learn R Programming

toro (version 0.1.0)

add_custom_control: Add a custom HTML control to the map

Description

Add a custom HTML control to the map

Usage

add_custom_control(
  map,
  id,
  html,
  position = "top-right",
  panel_id = NULL,
  section_title = NULL,
  group_id = NULL
)

Value

The map or map proxy object for chaining.

Arguments

map

The map or map proxy object.

id

The ID for the custom control.

html

The HTML content to add as a control.

position

The position of the control on the map. Default is "top-right". Options include "top-left", "top-right", "bottom-left", "bottom-right".

panel_id

ID of control panel to add to (optional).

section_title

Section title when added to a control panel.

group_id

ID of control group to add to (optional).

Examples

Run this code
# Add to a map
map() |>
 add_custom_control(
   id = "custom_control",
   html = "I am a custom control"
)

# Add to a control panel
map() |>
 add_control_panel(panel_id = "my_panel", title = "Map Settings") |>
 add_custom_control(
   id = "custom_control_panel",
   html = "I am a custom control in a panel",
   panel_id = "my_panel",
   section_title = "Custom Control Section"
 )

# Add to a control panel inside a control group
map() |>
 add_control_panel(panel_id = "my_panel", title = "Map Settings") |>
 add_control_group(
   panel_id = "my_panel",
   group_id = "custom_controls",
   group_title = "Custom Controls"
   ) |>
 add_custom_control(
   id = "custom_control_panel",
   html = "I am a custom control in a panel",
   panel_id = "my_panel",
   group_id = "custom_controls"
 )

Run the code above in your browser using DataLab