npx skills add ...
npx skills add ferminrp/agent-skills --skill mapcn
Technical guide to integrate mapcn in React + shadcn projects. Use when the user asks to integrate mapcn, add mapcn to a shadcn app, use mapcn MapControls/Markers/Routes/Clusters, implement controlled viewport state, use the useMap hook, or access MapLibre through mapcn.
npx skills add ferminrp/agent-skills --skill mapcn
Use this skill when the user needs to install, integrate, customize, or troubleshoot mapcn in a React + shadcn/ui codebase.
Typical triggers:
integrate mapcnadd mapcn to shadcn projectmapcn MapControls/Markers/Routes/Clusterscontrolled map viewport with mapcnuseMap hook mapcnMapLibre with mapcn componentsmapcn provides copy-paste style map components built on top of MapLibre GL JS and aligned with shadcn/ui workflows.
Assumptions:
Default behavior:
Canonical install command:
Expected integration result:
components/ui).Use a fixed-height container and render Map with MapControls.
Important:
Use uncontrolled mode for simple cases, and controlled mode when state synchronization is needed.
MapControls supports common toggles and placement:
showZoomshowCompassshowLocateshowFullscreenpositionUse marker composition for richer UI:
MapMarkerMarkerContentMarkerPopupMarkerTooltipMarkerLabelUse MapPopup for popup UI not strictly attached to a marker component.
Use MapRoute to draw path-based overlays and route-like lines.
Use MapClusterLayer with GeoJSON input for dense point datasets.
MapRefUse MapRef for imperative map actions such as flyTo, custom camera transitions, and direct map instance operations.
useMapUse useMap to access map context safely and wire event listeners with lifecycle-aware cleanup.
Use styles prop (or the corresponding map style config option) with MapLibre-compatible style URLs/specs when default tiles are not enough.
MapClusterLayer).Check:
Local references:
references/docs-pages.mdreferences/api-cheatsheet.mdCanonical docs:
https://www.mapcn.dev/docshttps://www.mapcn.dev/docs/installationhttps://www.mapcn.dev/docs/api-referencehttps://www.mapcn.dev/docs/basic-maphttps://www.mapcn.dev/docs/controlshttps://www.mapcn.dev/docs/markershttps://www.mapcn.dev/docs/popupshttps://www.mapcn.dev/docs/routeshttps://www.mapcn.dev/docs/clustershttps://www.mapcn.dev/docs/advanced-usageconst [viewport, setViewport] = useState({
longitude: -58.3816,
latitude: -34.6037,
zoom: 11,
});
<Map viewport={viewport} onViewportChange={setViewport} />