ReverseGeocodeField

Read-only field that displays a human-readable address resolved from a lat/lng pair on the current record. Falls back to truncated coordinates while loading or when reverse geocoding returns no result.

Installation

pnpm dlx shadcn@latest add @shadmin/reverse-geocode-field

Usage

import { ReverseGeocodeField } from "@/components/leaflet";
 
<Show>
  <SimpleShowLayout>
    <ReverseGeocodeField latSource="lat" lngSource="lng" />
  </SimpleShowLayout>
</Show>;

Returns null when either coordinate is missing on the record.

Props

PropRequiredTypeDefaultDescription
latSourceRequiredstring-Record field name for latitude.
lngSourceRequiredstring-Record field name for longitude.
formatOptional"full" | "street" | "city""full"How much of the display name to render. street = first segment, city = first two.
classNameOptionalstring-Optional CSS class on the rendered <span>.
providerOptionalGeocodingProvidernominatimProviderCustom provider (search/reverse interface).
enabledOptionalbooleantrueReact Query enabled flag.
endpointOptionalstringNominatimProvider endpoint override.