Controls

Add interactive controls to your map for zoom, compass, location, and fullscreen.

Installation

First, make sure you have the base map component installed:

npx shadcn@latest add https://www.terrae.dev/map.json

Then install the controls component:

npx shadcn@latest add https://www.terrae.dev/controls.json

Zoom

The MapZoom component provides zoom in and zoom out buttons.

Orientation

The MapOrientation component shows a compass that displays the current map bearing and resets the map orientation when clicked. Try rotating the map (hold Ctrl/Cmd + drag) to see the compass rotate.

Fullscreen

The MapFullscreen component toggles fullscreen mode for the map container.