Leaflet Control
To show the search control on your leaflet map, add the SearchControl
to the leaflet map
import { SearchControl, OpenStreetMapProvider } from 'leaflet-geosearch';const searchControl = new SearchControl({provider: new OpenStreetMapProvider(),style: 'bar',});map.addControl(searchControl);
Style
import { SearchControl, OpenStreetMapProvider } from 'leaflet-geosearch';const searchControl = new SearchControl({style: 'button',provider: new OpenStreetMapProvider(),});map.addControl(searchControl);
Message if address not found
import { SearchControl, OpenStreetMapProvider } from 'leaflet-geosearch';const searchControl = new SearchControl({notFoundMessage: 'Sorry, that address could not be found.',provider: new OpenStreetMapProvider(),style: 'bar',});map.addControl(searchControl);``## Properties<Props of={SearchControl} />