PointField

Read-only Leaflet map that renders a GeoJSON.Point geometry stored at a record field.

Installation

pnpm dlx shadcn@latest add @shadmin/point-field

Usage

import { PointField } from "@/components/leaflet";
 
<Show>
  <SimpleShowLayout>
    <PointField source="geom" />
  </SimpleShowLayout>
</Show>;

Renders an empty-state panel when the record value is missing.

Props

PropRequiredTypeDefaultDescription
sourceRequiredstring-Record field holding the Point geometry.
zoomOptionalnumber13Initial zoom level.
defaultCenterOptional[number, number][0, 0]Fallback center [lat, lng].
heightOptionalnumber | string300Height of the map container.
tileUrlOptionalstringOpenStreetMap tile URLTile layer URL template.
attributionOptionalstringOSM attributionTile attribution string.
pathOptionsOptionalL.PathOptions{ color: "#3388ff" }Vector styling (unused for Point markers).
markerIconOptionalL.Icon | L.DivIconshared MarkerIconIcon used for the Point marker.
fitBoundsOptionalbooleantrueAuto-fit map view to the geometry on mount.
emptyTextOptionalReactNode"No geometry…"Text shown when the value is missing.
testIdOptionalstring-data-testid for the map container.