map-with-draw-control-specific-shapes

PreviousNext
Docs
shadcn-mapexample

Preview

Loading preview…
registry/new-york-v4/examples/map-with-draw-control-specific-shapes.tsx
import {
    Map,
    MapDrawCircle,
    MapDrawControl,
    MapDrawEdit,
    MapDrawPolygon,
    MapDrawRectangle,
    MapTileLayer,
} from "@/registry/new-york-v4/ui/map"
import type { LatLngExpression } from "leaflet"

export function MapWithDrawControlSpecificShapes() {
    const TORONTO_COORDINATES = [43.6532, -79.3832] satisfies LatLngExpression

    return (
        <Map center={TORONTO_COORDINATES}>
            <MapTileLayer />
            <MapDrawControl>
                <MapDrawCircle />
                <MapDrawRectangle />
                <MapDrawPolygon />
                <MapDrawEdit />
            </MapDrawControl>
        </Map>
    )
}

Installation

npx shadcn@latest add @shadcn-map/map-with-draw-control-specific-shapes

Usage

import { MapWithDrawControlSpecificShapes } from "@/components/map-with-draw-control-specific-shapes"
<MapWithDrawControlSpecificShapes />