Skip to main content

alphaThis is a new frontend component. Help us improve it and give your feedback on Slack.

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
})