Skip to Content
πŸŽ‰ Coral x Panda has been released πŸŽ‰ Read the Migration Guide
DocumentationMapsCoralMapMarker

CoralMapMarker

CoralMapMarker allows overlaying multiple points over a CoralMap basemap. This is a wrapper around react-map-gl Marker componentΒ . You must use CoralMapMarker’s as children of CoralMap.

Import

import { CoralMapMarker } from '@krakentech/coral-maps';

Basic usage

const FEATURES: PointFeature[] = [ { id: '1', type: 'Feature', geometry: { type: 'Point', coordinates: [-0.1276, 51.5074], }, properties: { name: 'London', }, }, { id: '2', type: 'Feature', geometry: { type: 'Point', coordinates: [-2.2426, 53.4808], }, properties: { name: 'Manchester', }, }, { id: '3', type: 'Feature', geometry: { type: 'Point', coordinates: [-4.2518, 55.8642], }, properties: { name: 'Glasgow', }, }, ]; <CoralMap mapboxAccessToken="..."> <CoralMapMarker feature={FEATURES[0]} /> <CoralMapMarker feature={FEATURES[1]} /> <CoralMapMarker feature={FEATURES[2]} /> </CoralMap>;

Properties

Color

<CoralMap mapboxAccessToken="..."> <CoralMapMarker feature={FEATURES[0]} /> <CoralMapMarker feature={FEATURES[1]} color="secondary" /> <CoralMapMarker feature={FEATURES[2]} color="primary" /> </CoralMap>

Size

<CoralMap mapboxAccessToken="..."> <CoralMapMarker feature={FEATURES[0]} size="small" /> <CoralMapMarker feature={FEATURES[1]} /> <CoralMapMarker feature={FEATURES[2]} color="large" /> </CoralMap>

Icon

<CoralMap mapboxAccessToken="..."> <CoralMapMarker feature={FEATURES[0]} icon={<IconBolt color='duotone' size={16} />} /> <CoralMapMarker feature={FEATURES[1]} icon={<IconSolarPanel color='duotone' size={16} />} /> <CoralMapMarker feature={FEATURES[2]} icon={<IconBolt color='duotone' size={16} />} /> </CoralMap>

Full API

NameTypeDefault
elementHTMLElement
offsetPointLike
anchorAnchor$1
color"primary" | "secondary" | "tertiary"

The colour of the marker

primary
scalenumber
draggableboolean
clickTolerancenumber
rotationnumber
rotationAlignmentstring
pitchAlignmentstring
occludedOpacitynumber
classNamestring
altitudenumber
styleCSSProperties

CSS style override, applied to the control’s container

onDragStart(e: MarkerDragEvent) => void
onDrag(e: MarkerDragEvent) => void
onDragEnd(e: MarkerDragEvent) => void
childrenReact.ReactNode
featurePointFeature

A GeoJSON point feature

iconReactNode

Displays a Coral Icon inside the marker

sizeCoralMapMarkerSize

The size of the marker

medium
onClick(event: CoralMapMarkerEvent) => void

A callback function to be triggered upon clicking/tapping the marker

Last updated on