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
Last updated on