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 | null | Unique identifier for events |
| :draggable | bool | false | Enable user to drag the marker |
| color | string | '#1A56DB' | Color for the default marker pin |
| anchor | string | 'bottom' | Options: center, top, bottom, etc. |
| :offset | array | [0, 0] | Pixel offset [x, y] |
| :rotation | float | 0 | Clockwise rotation in degrees |
| rotation-alignment | string | 'auto' | 'map', 'viewport', or 'auto' |
| pitch-alignment | string | 'auto' | 'map', 'viewport', or 'auto' |
| class | string | '' | CSS class for the marker container |
Renders custom HTML as the marker icon. Place any HTML in the slot.
| Prop | Description |
|---|---|
| class | CSS class for the wrapper element |
Adds a floating text label to the marker.
| Prop | Description |
|---|---|
| text | Label text content |
| position | Options: top, bottom, left, right (Default: bottom) |
| class | Additional CSS classes |
Adds a hover-triggered tooltip popup.
| Prop | Description |
|---|---|
| text | Tooltip text content |
| anchor | Corner connection point |
| :offset | Pixel offset [x, y] |
| class | CSS class for the tooltip wrapper |
Adds a click-to-open popup containing arbitrary HTML.
| Prop | Description |
|---|---|
| max-width | CSS max-width (Default: '300px') |
| :close-button | Toggle the little 'x' (Default: true) |
| :close-on-click-map | Close if map is clicked (Default: true) |
| :close-on-move | Close if map camera moves (Default: false) |
| anchor | Popup connection point (Default: bottom) |
| :offset | Pixel offset [x, y] (Default: [0, 0]) |
| class | CSS base class for the popup container |