Skip to Content
🎉 Coral x Panda has been released 🎉 Read the Migration Guide
DocumentationMapsInstallation

Installation

coral-maps

Be sure to follow the steps from Installation to set up your project with Panda CSS and Coral before using this package.

Install dependencies

npm i @krakentech/coral-maps mapbox-gl react-map-gl

Prerequisites

PackageVersionRequired
@krakentech/coral^30.0.0

Required

@krakentech/coral-design^4.0.0

Required

@krakentech/icons^9.0.0

Required

@krakentech/utils^2.0.0

Required

mapbox-gl^3.0.0

Required

react^18.2.0 || ^19.0.0

Required

react-map-gl^8.1.0

Required

@types/react^18.2.0 || ^19.0.0

Optional

Additional Setup

Import Mapbox CSS

You will need to import Mapbox GL’s CSS in your application:

  • Pages Router: in pages/_app.tsx
  • App Router: in app/layout.tsx
import "mapbox-gl/dist/mapbox-gl.css";

Mapbox Token

Coral Maps uses Mapbox GL , which requires a valid Mapbox token  to render any map. You will need to generate a token for every new project:

  • If you haven’t already, you must ask for access to the Mapbox console through the Okta access requests portal
  • Log in to the Mapbox console 
  • Create a new token . Do not use the default public token. You will not likely need to modify the preselected token scopes.
  • Set up URL restrictions for your token, and please be mindful of not exposing it in your source code (usually the token would be stored in your project’s .env file)

Usage

Minimalistic Setup

This is the bare minimum you’ll need to display a map. Wrap your CoralMap component with next/dynamic and { ssr: false } to ensure it runs only on the client:

// Pages Router: put this in pages/_app.tsx // App Router: put this in app/layout.tsx import "mapbox-gl/dist/mapbox-gl.css"; // Any page or component: import dynamic from "next/dynamic"; const CoralMapClient = dynamic( () => import("@krakentech/coral-maps").then((mod) => mod.CoralMap), { ssr: false }, ); export default () => { return ( <CoralMapClient mapboxAccessToken="{see documentation above about Mapbox tokens}" /> ); };
Last updated on