async-map-modal

Promise-based map modal: single or multiple coordinate selection, list with checkboxes, single/bulk delete.

Demos

Single selection

Click once on the map to select a point. Returns { lat, lng } or null.

Multiple selection

Add multiple points, select and delete from the list with checkboxes, or clear all.

More examples

Custom icon (single selection)

Use red circle icon with markerIcon. Single point selection.

Custom icon (multiple selection)

Multiple selection with custom icon: green square marker.

Default points

Pre-filled points in the list when the modal opens via initialPoints (edit and click OK).

Features

API Reference (all parameters)

Full documentation with types, defaults and code examples:

Parameter documentation

showMapModal, init, getConfig, setTheme, setLanguage and all options are documented.

Usage

// Install
yarn add async-map-modal leaflet

// Leaflet + modal CSS on page (script + link)
// Single selection
const result = await asyncMapModal.show({ leaflet: L });
// result: { lat, lng } | null

// Multiple selection
const points = await asyncMapModal.show({ multiSelect: true, leaflet: L });

// Custom marker, initialPoints etc. via options
asyncMapModal.show({ markerIcon: redIcon, initialPoints: [...], leaflet: L });