MapWithSearch

An address search over a map: a <GeocodingInput> on addressSource above a map with a pin on latSource and lngSource. Picking a result fills all three fields and moves the pin. Clicking the map or dragging the pin writes the address of that spot, unless the service finds none, and the lookup runs only after such a gesture, never on mount and never after a pick, so a picked address is never overwritten. Needs the optional maplibre-gl peer.

Loading preview…

An address search over a map: a <GeocodingInput> on addressSource above a map with a pin on latSource and lngSource. Picking a result fills all three fields and moves the pin. Clicking the map or dragging the pin writes the address of that spot, unless the service finds none, and the lookup runs only after such a gesture, never on mount and never after a pick, so a picked address is never overwritten. Needs the optional maplibre-gl peer.

Installation

import { MapWithSearch } from "@chelone/react/maps/osm";

See the maps guide for the subpaths, the optional packages and MapsProvider.

Props

PropTypeDefaultDescription
addressSourceSourceProp<TRecord>—The form field holding the address text.
classNamestring—
heightstring | number—In pixels, or any CSS length. Defaults to 400.
latSourceSourceProp<TRecord>—The form field holding the latitude.
lngSourceSourceProp<TRecord>—The form field holding the longitude.
providerGeocodingProvider—Defaults to the `geocoder` of `MapsProvider`. One of the two is required.
zoomnumber—Read once at mount. Defaults to 13.