BBoxField

Read-only Leaflet map that renders a GeoJSON.BBox ([west, south, east, north]) as a rectangular polygon stored at a record field.

Installation

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

Usage

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

Internally converts the BBox to a Polygon and renders via ShapeFieldShell inside a wrapping RecordContextProvider.

Props

PropRequiredTypeDefaultDescription
sourceRequiredstring-Record field holding the BBox tuple.
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" }Fill/stroke style options.
markerIconOptionalL.Icon | L.DivIconshared MarkerIconIcon (unused).
fitBoundsOptionalbooleantrueAuto-fit map view to the bbox.
emptyTextOptionalReactNode"No geometry…"Text shown when the value is missing.
testIdOptionalstring-data-testid for the map container.