Button-triggered map
Trigger the map to show on button press, allowing users to access the map when needed without it taking up space on the page by default.
The map requires JavaScript to be enabled.
import InteractiveMap from '@defra/interactive-map'import maplibreProvider from '@defra/interactive-map/providers/maplibre'
new InteractiveMap('my-map', { behaviour: 'buttonFirst', mapProvider: maplibreProvider(), mapStyle: { url: 'https://your-tile-url/style.json', attribution: 'Your tile attribution' }, center: [-1.6, 53.1], zoom: 6, hasExitButton: true})<script src="/your-assets-path/interactive-map/index.js"></script><script src="/your-assets-path/maplibre-provider/index.js"></script>
<script>new defra.InteractiveMap('my-map', { behaviour: 'buttonFirst', mapProvider: defra.maplibreProvider(), mapStyle: { url: 'https://your-tile-url/style.json', attribution: 'Your tile attribution' }, center: [-1.6, 53.1], zoom: 6, hasExitButton: true})</script>