Laravel Mapcn
Toggle sidebar

Markers

Docs / Markers

Overview

The <x-map-marker> component displays interactive markers on the map. Markers support custom colors, labels, tooltips, popups, dragging, and fully custom HTML content.

Basic Marker

Labels & Tooltips

Add text labels near the marker and hover tooltips using sub-components:

Marker Popup

Add a click-to-open popup to a marker with custom HTML content:

Custom Marker Content

Replace the default marker pin with completely custom HTML using <x-marker-content>:

Multiple Markers

Add as many markers as you need, each with their own props:

Props

PropTypeDefaultDescription
:latfloatrequiredLatitude
:lngfloatrequiredLongitude
idstringUUIDUnique marker identifier
:draggableboolfalseAllow user to drag marker
colorstring'#1A56DB'Default dot color
anchorstring'bottom'Anchor point (center, bottom, etc.)

Sub-Components

<x-marker-content>

Renders custom HTML as the marker icon. Place any HTML in the slot.

<x-marker-label>

Adds a text label near the marker.

PropDescription
textThe label text
positiontop, bottom, left, right

<x-marker-tooltip>

Adds a hover tooltip using MapLibre's Popup.

PropDescription
textThe tooltip text

<x-marker-popup>

Adds a click-to-open popup. Supports any HTML in the slot.

PropDescription
anchorWhere to anchor relative to marker
max-widthCSS max-width for the popup