Installation
How to install and set up mapcn in your project.
Prerequisites
A project with Tailwind CSS and shadcn/ui set up.
Installation
Run the following command to add the map component:
npx shadcn@latest add https://mapcn.vercel.app/maps/map.jsonThis will install maplibre-gl and add the map component to your project.
Usage
Import and use the map component:
import { Map, MapControls } from "@/components/ui/map";
import { Card } from "@/components/ui/card";
export function MyMap() {
return (
<Card className="h-[300px] p-0 overflow-hidden">
<Map center={[-74.006, 40.7128]} zoom={11}>
<MapControls />
</Map>
</Card>
);
}Note: The map uses free CARTO basemap tiles by default. No API key required. Tiles automatically switch between light and dark themes.