<ScriptMapLibreAttributionControl>
Moves or restyles the map's attribution. Use it to change the attribution position, force compact mode, or add your own credits.
<template>
<ScriptMapLibreMap map-style="https://tiles.openfreemap.org/styles/liberty" :center="[147.33, -42.88]">
<ScriptMapLibreAttributionControl
position="bottom-left"
:options="{ compact: false, customAttribution: 'Data: Hobart City Council' }"
/>
</ScriptMapLibreMap>
</template>How it works with the default attribution
MapLibre adds an attribution control to every map by default. Two controls would show the attribution twice. This component prevents that:
- When the component mounts, it removes the map's attribution control and adds its own.
- When the component unmounts, it adds the map's control back. This also happens if your code removed the component's control first.
When no other attribution control is present, the map shows attribution exactly once. Unmounting the component does not remove the default attribution.
If you set attributionControl: false in the map options, the map has no control to restore. The component then adds its own control, and unmounting removes it.
The component replaces only the control that <ScriptMapLibreMap> adds. If your code adds an attribution control with map.addControl(), that control stays on the map.
Use one <ScriptMapLibreAttributionControl> per map. The map's control returns to its default position, bottom-right, when the component unmounts.
Attribution text
The control always shows the attribution from the style sources, for example OpenFreeMap and OpenStreetMap. options cannot remove it.
The component options override the options of the map's attribution control. Options you omit keep the map's values.
If you omit options.customAttribution, the credits from the map's control stay, including MapLibre's default "MapLibre" link. If you set it, your value replaces them.
new maplibregl.AttributionControl() reads options and position once, when it creates the control. To apply a change, change the component key.
positionMapLibre.ControlPositionoptionsMapLibre.AttributionControlOptionsOptions passed to `new maplibregl.AttributionControl()`. Source attribution from the style and tiles always shows. `customAttribution` only adds text.