Add search bar to Leaflet

Estimated reading time: 1 minute

Find usage examples of Jawg Places with Leaflet. All options from <input> examples will work here too, make sure you use the class Leaflet. When Jawg Places JS is loaded, you can have access to the Leaflet class.

See the class definition here.

const map = new L.Map("my-map").setView([0, 0], 2);
let jawgPlaces = new JawgPlaces.Leaflet({ L: L });
// Use it as a Leaflet control plugin, the input will be on the map
map.addControl(jawgPlaces);
// Or as a standalone input that will be connected to de map
jawgPlaces.attachMap(map);