← All components

Controls

Zoom, compass, locate, fullscreen and a theme switcher built from shadcn buttons.

Previews run on MapScale's public Thailand archive.

Install

npx shadcn@latest add https://mapscale.io/r/map-controls.json

Usage

import { MapControls } from "@/components/mapscale/map-controls"

<Map>
	<MapControls position="top-right" locate fullscreen styleSwitcher />
</Map>

Props

PropTypeDefaultDescription
positioncorner"top-right"Corner of the map: top-left, top-right, bottom-left or bottom-right.
zoombooleantrueZoom in and out buttons.
compassbooleantrueCompass that resets bearing and pitch.
locatebooleanfalseButton that flies to the visitor's location.
fullscreenbooleanfalseFullscreen toggle for the whole map.
styleSwitcherbooleanfalseMenu that swaps the basemap theme without remounting.

Keys

Maps, autocomplete and place details use a publishable pk_ key that is safe in the browser. Routing and isochrones need a secret sk_ key, so they go through the proxy route your app serves.