The <x-map-marker> component displays interactive markers on the map. Markers support custom colors, labels, tooltips, popups, dragging, and fully custom HTML content.
Add text labels near the marker and hover tooltips using sub-components:
Add a click-to-open popup to a marker with custom HTML content:
Visit us anytime!
Replace the default marker pin with completely custom HTML using <x-marker-content>:
Add as many markers as you need, each with their own props:
| Prop | Type | Default | Description |
|---|---|---|---|
| :lat | float | required | Latitude |
| :lng | float | required | Longitude |
| id | string | UUID | Unique marker identifier |
| :draggable | bool | false | Allow user to drag marker |
| color | string | '#1A56DB' | Default dot color |
| anchor | string | 'bottom' | Anchor point (center, bottom, etc.) |
Renders custom HTML as the marker icon. Place any HTML in the slot.
Adds a text label near the marker.
| Prop | Description |
|---|---|
| text | The label text |
| position | top, bottom, left, right |
Adds a hover tooltip using MapLibre's Popup.
| Prop | Description |
|---|---|
| text | The tooltip text |
Adds a click-to-open popup. Supports any HTML in the slot.
| Prop | Description |
|---|---|
| anchor | Where to anchor relative to marker |
| max-width | CSS max-width for the popup |