map-with-polyline

PreviousNext
Docs
shadcn-mapexample

Preview

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

export function MapWithPolyline() {
    const POINTS = [
        [43.6532, -79.3832],
        [43.6545, -79.38],
    ] satisfies LatLngExpression[]

    return (
        <Map center={POINTS[0]}>
            <MapTileLayer />
            <MapPolyline positions={POINTS} />
        </Map>
    )
}

Installation

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

Usage

import { MapWithPolyline } from "@/components/map-with-polyline"
<MapWithPolyline />