map-with-polygon

PreviousNext
Docs
shadcn-mapexample

Preview

Loading preview…
registry/new-york-v4/examples/map-with-polygon.tsx
import { Map, MapPolygon, MapTileLayer } from "@/registry/new-york-v4/ui/map"
import type { LatLngExpression } from "leaflet"

export function MapWithPolygon() {
    const BOUNDS = [
        [43.65, -79.387],
        [43.657, -79.38],
        [43.649, -79.379],
    ] satisfies LatLngExpression[]

    return (
        <Map center={BOUNDS[0]} zoom={14}>
            <MapTileLayer />
            <MapPolygon positions={BOUNDS} />
        </Map>
    )
}

Installation

npx shadcn@latest add @shadcn-map/map-with-polygon

Usage

import { MapWithPolygon } from "@/components/map-with-polygon"
<MapWithPolygon />