InfoBox

The InfoBox component renders custom styled content in a Google Maps overlay pane.

Storybook

Open the InfoBox story

Props

PropTypeDescription
anchorgoogle.maps.MVCObjectOptional anchor object.
positiongoogle.maps.LatLng | google.maps.LatLngLiteralPosition used when no anchor is provided.
optionsInfoBoxOptionsInfoBox options such as boxClass, boxStyle, pixelOffset, and closeBoxURL.
zIndexnumberOverlay z-index.
isOpenbooleanOpens or closes the InfoBox.
onLoad(infoBox) => voidCalled after creation.
onUnmount(infoBox) => voidCalled before removal.

Events

onCloseClick, onDomReady, onContentChanged, onPositionChanged, and onZindexChanged map to the corresponding InfoBox events.

Usage

<InfoBox position={center} options={{ closeBoxURL: '', boxClass: 'info-box' }}>
  <strong>Custom overlay content</strong>
</InfoBox>
svelte