Skip to content

Change the default position for attribution

Replicates the MapLibre example Change the default position for attribution.

Attribution sits top-left instead of bottom-right
change-the-default-position-for-attribution.yaml
# yaml-language-server: $schema=https://docs.maplibre-yaml.org/schema/latest/map.schema.json
# Gallery twin of https://maplibre.org/maplibre-gl-js/docs/examples/change-the-default-position-for-attribution/
type: map
id: change-the-default-position-for-attribution
config:
center: [-77.0353, 38.8895]
zoom: 12
mapStyle: "https://demotiles.maplibre.org/style.json"
# customAttribution gives the control text: declaring controls.attribution
# replaces the built-in control, and if neither it nor any source
# contributes attribution text the control renders empty — i.e. invisible.
controls:
attribution:
position: top-left
customAttribution: "MapLibre demo tiles"
  • Declaring controls.attribution replaces the built-in control; position takes any of the four corners.
  • customAttribution matters here: the replacement control only shows source-contributed attribution text, and if there is none it renders empty — invisible. Give it content when your basemap carries no attribution of its own.