Skip to content

popup

Stable

A popup with text or HTML content, placed at a coordinate.

Generated from the component's definition in the library, so it always matches the version this demo runs.

Attribute Type Default Description
id required string — Unique identifier for the popup
map_id required string — ID of the map to add the popup to
lng_lat list nil Popup position as [longitude, latitude]. If not provided, popup will be created but not displayed until positioned
max_width string "240px" Maximum width of the popup. Defaults to "240px"
close_button boolean true Show close button. Defaults to true
close_on_click boolean true Close popup when clicking on the map. Defaults to true
close_on_move boolean false Close popup when moving the map. Defaults to false
anchor string "auto" Popup anchor point. One of: "center", "top", "bottom", "left", "right", "top-left", "top-right", "bottom-left", "bottom-right", "auto". Defaults to "auto", which, like nil, lets MapLibre choose the anchor that keeps the popup in view
offset any nil Pixel offset as [x, y] or single number for all sides
class_name string nil CSS class name for the popup container
focus_after_open boolean true Whether the popup moves the keyboard focus to its first focusable element (a link, a button, a field; else the close button) as it opens, MapLibre's focusAfterOpen. Defaults to true. false leaves the focus where it is: for a popup the server opens while the visitor may be typing in a field elsewhere on the page, or one a page control opens, whose next Space or Enter should stay with that control
open boolean nil Whether the popup should be open. Defaults to true when lng_lat is provided. A popup without a position stays closed even with open={true}, and the browser console warns; it opens once it gets a position
global attributes global — Any other HTML attribute, passed on to the component's element.
events any [] a list of event names, or :all

Slots

  • inner_block Required.