Skip to content
BillyGalbreath edited this page Apr 18, 2024 · 6 revisions
Example json is at the bottom of the page

The popup is used to open popups in certain places of the map.


Popup Options

key type default description
"content" string "" Sets the HTML contents of the popup
"offset" Point [0, 7] The offset of the popup position
"maxWidth" number 300 Max width of the popup, in pixels
"minWidth" number 50 Min width of the popup, in pixels
"maxHeight" number null If set, creates a scrollable container of the given height inside a popup if its content exceeds it. The scrollable container can be styled using the leaflet-popup-scrolled CSS class selector
"autoPan" boolean true Set it to false if you don't want the map to do panning animation to fit the opened popup
"autoPanPaddingTopLeft" Point null The margin between the popup and the top left corner of the map view after autopanning was performed
"autoPanPaddingBottomRight" Point null The margin between the popup and the bottom right corner of the map view after autopanning was performed
"autoPanPadding" Point [5, 5] Equivalent of setting both top left and bottom right autopan padding to the same value
"keepInView" boolean false Set it to true if you want to prevent users from panning the popup off of the screen while it is open
"closeButton" boolean true Controls the presence of a close button in the popup
"autoClose" boolean true Set it to false if you want to override the default behavior of the popup closing when another popup is opened
"closeOnEscapeKey" boolean true Set it to false if you want to override the default behavior of the ESC key for closing of the popup
"closeOnClick" boolean true Set it if you want to override the default behavior of the popup closing when user clicks on the map
"className" string "" A custom CSS class name to assign to the popup
"bubblingMouseEvents" boolean true When true, a mouse event on this popup will trigger the same event on the map
"interactive" boolean false If true, the popup will listen to the mouse events
"pane" string "popupPane" Map pane where the popup will be added
"attribution" string null String to be shown in the attribution control

Popup Example

Sample green circle at world center with radius of 20 blocks.

{
  "id": "example_popup_layer",
  "label": "Example Popup",
  "markers": [
    {
      "type": "circle",
      "id": "unique_id_001",
      "point": [512000, 512000],
      "options": {
        "radius": 20
      },
      "popup": {
        "content": "This is a fancy circle"
      }
    }
  ]
}