Marker
TheMarker component displays markers (pins) on the map at specific coordinates. Supports custom icons, labels, and drag behavior.
Props
{ lat: number; lng: number }
required
Marker position coordinates
string
Text label to display on the marker
boolean
default:false
Enable drag behavior for the marker
string
URL to custom icon image
{ w: number; h: number }
Custom icon size in pixels
{ x: number; y: number }
Icon anchor point (where the icon points to on the map)
(event: H.mapevents.Event) => void
Callback fired when marker drag ends
Basic Usage
Multiple Markers
Draggable Marker
Custom Icon
The
iconAnchor determines which point of the icon image corresponds to the marker’s geographical position. For a pin-shaped icon, set it to the bottom center (e.g., { x: width/2, y: height }).Interactive Markers
TypeScript Types
Performance Tips
Large number of markers
Large number of markers
For 100+ markers, consider using marker clustering or virtualization techniques. Render only markers in the visible viewport.
Custom icons
Custom icons
Optimize icon images for web (WebP format, appropriate size). Preload icons that will be used frequently.
Drag performance
Drag performance
Avoid heavy computations in
onDragEnd. Use debouncing for API calls triggered by marker position changes.See Also
HereMap
Map container component
Polyline
Draw lines between markers
Examples
Interactive marker examples