Laravel Mapcn
Toggle sidebar

Popups

Docs / Popups

Overview

The <x-map-popup> component creates standalone popups anchored to specific coordinates on the map. Unlike marker popups, these are not attached to a marker and can be opened independently.

Basic Usage

With Close Button

Add a close button so users can dismiss the popup:

Close on Move

Automatically close the popup when the user pans or moves the map:

blade
<x-map-popup
    :lat="51.505"
    :lng="-0.09"
    :open="true"
    :close-on-move="true"
>
    <p>I'll close when you move the map!</p>
</x-map-popup>

Props

PropTypeDefaultDescription
:latfloatrequiredLatitude
:lngfloatrequiredLongitude
id?stringnullUnique identifier for events
:openbooltrueInitial visibility
max-widthstring'300px'CSS max-width (e.g., 'none')
:close-buttonboolfalseShow the 'x' close button
:close-on-click-mapbooltrueClose when map is clicked
:close-on-moveboolfalseClose when the map camera moves
anchorstring'bottom'Options: top, bottom, left, right, etc.
:offsetarray[0, 0]Pixel offset [x, y]
classstring''Additional CSS classes