LatLngField

Read-only Leaflet map with a marker at the lat/lng pair read from the current record. Renders an empty-state panel when either coordinate is missing.

Installation

pnpm dlx shadcn@latest add @shadmin/lat-lng-field

Usage

import { LatLngField } from "@/components/leaflet";
 
<Show>
  <SimpleShowLayout>
    <TextField source="name" />
    <LatLngField latSource="lat" lngSource="lng" zoom={13} height={300} />
  </SimpleShowLayout>
</Show>;

Props

PropRequiredTypeDefaultDescription
latSourceRequiredstring-Record field name for the latitude value.
lngSourceRequiredstring-Record field name for the longitude value.
zoomOptionalnumber13Initial zoom level.
heightOptionalnumber | string300Height of the map container (px or CSS unit).
tileUrlOptionalstringOpenStreetMap tile URLTile layer URL template.
attributionOptionalstringOpenStreetMap attributionHTML attribution string shown on the map.

tileUrl

Accepts a custom tileUrl for using a different tile provider (Mapbox, Stadia, CartoDB). The URL must follow the Leaflet tile template format: https://{s}.example.com/{z}/{x}/{y}.png.