Skip to content

@maplibre-yaml/core/register

Auto-registration for maplibre-yaml web components

Import this module to automatically register the <ml-map> web component.

import '@maplibre-yaml/core/register';
import 'maplibre-gl/dist/maplibre-gl.css';

After importing, the <ml-map> element is available in your HTML.

External YAML file (recommended)

<ml-map src="/configs/my-map.yaml" style="height: 400px;"></ml-map>

Inline YAML via script tag

<ml-map style="height: 400px;">
<script type="text/yaml">
type: map
id: my-map
config:
center: [-74.006, 40.7128]
zoom: 12
mapStyle: "https://demotiles.maplibre.org/style.json"
layers: []
</script>
</ml-map>

JSON config attribute (programmatic)

<ml-map config='{"type":"map","id":"demo",...}'></ml-map>

Re-exports MLMap


Re-exports MLMapErrorDetail


Re-exports MLMapEventMap


Re-exports registerMLMap