SDKs · React & Next.js
Step 5 — Taps & info windows
Respond to taps and show a popup above a marker.
<UbHubMap
style={{ height: 480 }}
markers={markers}
onMarkerTap={(marker) => console.log("tapped", marker.id, marker.data)}
onPolylineTap={(line) => {}}
onPolygonTap={(polygon) => {}}
onCircleTap={(circle) => {}}
onClick={(point) => console.log("basemap tap", point)} // not fired over a marker/shape
onLongPress={(point) => console.log("long press", point)} // right-click or touch hold
infoWindow={(marker) => <div style={{ padding: "6px 10px" }}>{marker.label}</div>}
/>;onMarkerTap/onPolylineTap/onPolygonTap/onCircleTapgive you the annotation and itsdata.onClickfires only for basemap taps;onLongPressis a right-click or touch hold.infoWindowrenders a React popup above the tapped marker (usesreact-dom).