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

CoralMapPopup

CoralMapPopup is meant to provide additional information about a point on the map, usually when clicking on a CoralMapMarker. It is a convenience wrapper around react-map-gl’s Popup componentΒ , which is itself a React wrapper around Mapbox GL’s Popup objectΒ .

Import

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

Basic usage

const FEATURE: PointFeature = { id: '1', type: 'Feature', geometry: { type: 'Point', coordinates: [-0.1276, 51.5074], }, properties: { name: 'London', }, }; const [isPopupOpen, setPopupIsOpen] = useState(true); <CoralMap mapboxAccessToken="..."> <CoralMapMarker feature={FEATURE} onClick={() => setPopupIsOpen(!isPopupOpen)} /> {isPopupOpen && ( <CoralMapPopup feature={FEATURE} onClose={() => setIsOpen(false)}> <Typography variant="h3">{FEATURE.properties.name}</Typography> <Typography variant="body1"> {FEATURE.properties.description} </Typography> </CoralMapPopup> )} </CoralMap>;

Full API

NameTypeDefault
closeButtonboolean
closeOnClickboolean
closeOnMoveboolean
focusAfterOpenboolean
anchorAnchor$1
offsetOffset
classNamestring
maxWidthstring
altitudenumber
styleCSSProperties

CSS style override, applied to the control’s container

onOpen(e: PopupEvent) => void
onClose(e: PopupEvent) => void
childrenReact.ReactNode
featurePointFeature
Last updated on