Anmoldeep Singh

CustomLayer

Component 23

About

A MapLibre custom layer control that toggles interactive GeoJSON park polygons over a themed map.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds CustomLayer to your project and fits it to your theme.

Code

How CustomLayer is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import {
  CustomLayer,
  Map,
  MapControls,
} from "@/components/ui/mapcn-custom-layer";

const settings = {
  center: [-73.97, 40.78],
  zoom: 11.8,
};

export default function CustomLayerDemo(props: Partial<typeof settings>) {
  const s = { ...settings, ...props };
  return (
    <div className="h-screen w-screen flex items-center justify-center bg-background p-8 overflow-hidden">
      <div className="h-[420px] w-full max-w-4xl overflow-hidden rounded-xl border shadow-sm">
        <Map center={s.center} zoom={s.zoom}>
          <MapControls />
          <CustomLayer />
        </Map>
      </div>
    </div>
  );
}

export { CustomLayerDemo };

Dependencies

More by Anmoldeep Singh

View all
  • MarkerPopup

    MarkerPopup

    414
  • MapArc

    MapArc

    284
  • Map

    Map

    257
  • MarkerTooltip

    MarkerTooltip

    197
  • LayerMarkers

    LayerMarkers

    134
  • MarkerLabel

    MarkerLabel

    109
  • MarkerContent

    MarkerContent

    80
  • MapMarker

    MapMarker

    80