Display a popup

Add a Popup to the map.

NPM module setup


npm install --save @maptiler/sdk
import { Map, MapStyle, config, Popup } from '@maptiler/sdk';
import '@maptiler/sdk/dist/maptiler-sdk.css';

config.apiKey = 'YOUR_MAPTILER_API_KEY_HERE';
const map = new Map({
    container: 'map',
    style: MapStyle.STREETS, 
    center: [-96, 37.8],
    zoom: 3
});

const popup = new Popup({ closeOnClick: false })
    .setLngLat([-96, 37.8])
    .setHTML('<h1>Hello World!</h1>')
    .addTo(map);
Display a popup on hover

Display a popup on hover

Examples

Show a popup when hovering over a custom marker.

Show polygon information on click

Show polygon information on click

Examples

Display a popup when a user clicks a polygon.

Weather custom popup

Weather custom popup

Examples

Create highly customizable popups for weather maps using MarkerLayout.

Attach a popup to a marker instance

Attach a popup to a marker instance

Examples

Attach and display a popup to a map marker.

Was this helpful?