Map quickstart
Install the SDK, set your API key and show an interactive TomTom map. The code below is the whole app. Change the center or zoom and the map follows.
Prerequisites and setup
- Node.js 22+ and npm, pnpm or Yarn
- A TomTom API key from my.tomtom.com
- A browser with WebGL, which MapLibre renders with
Installing dependencies
# npm or Yarn - automatic peer dependency installationnpm install @tomtom-org/maps-sdk
# pnpm - enable auto-install-peers for easiest setupecho "auto-install-peers=true" >> .npmrcpnpm install @tomtom-org/maps-sdkmaplibre-gl and the SDK’s other peer dependencies install with it. The Project setup guide lists which peer dependencies each bundle needs and how to install them by hand.
Basic HTML setup
Give the map container a height. Otherwise, it renders with none:
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>TomTom Map Application</title> <style> #map { width: 100%; height: 400px; } </style></head><body> <div id="map"></div> <script type="module" src="./index.ts"></script></body></html>Creating your first map
import { TomTomConfig } from '@tomtom-org/maps-sdk/core';import { TomTomMap } from '@tomtom-org/maps-sdk/map';
TomTomConfig.instance.put({ apiKey: 'YOUR_API_KEY' });
const map = new TomTomMap({ mapLibre: { container: 'map' }});The map opens in the default streetLight style. The SDK applies the MapLibre CSS itself, so you don’t import a stylesheet (MapLibre CSS).
Next step
The map introduction explains how TomTomMap and its modules fit together. The TomTomMap guide covers every map option.