Laravel Mapcn
Toggle sidebar

Map

Docs / Map

Overview

The <x-map> component is the foundational building block for all maps. It initializes MapLibre GL JS, sets up the viewport, and provides the container for all child components like markers, popups, routes, and clusters.

Basic Usage

Tile Providers

Switch between built-in tile providers using the provider prop. You can also supply a custom MapLibre style JSON URL via the style prop.

Carto Positron (Light)

Carto Dark Matter

Theme Support

The theme prop controls how the map responds to dark mode. Set to "auto" (default) to follow your app's .dark class, or force "light" / "dark".

Props

PropTypeDefaultDescription
:centerarray[0, 0]Initial map center [lng, lat]
:zoomint13Initial zoom level (0–22)
:min-zoomint0Minimum zoom level
:max-zoomint22Maximum zoom level
providerstring'carto-voyager'Tile provider name
stylestringnullCustom MapLibre style JSON URL
themestring'auto''light', 'dark', or 'auto'
heightstring'400px'CSS height (e.g. 500px, 100vh)
widthstring'100%'CSS width
:bearingfloat0Initial bearing in degrees
:pitchfloat0Initial pitch (0–60 degrees)
:interactivebooltrueEnable mouse/touch interactions
:scroll-zoombooltrueAllow mouse wheel zoom