MaplibreX.Components.AttributionControl (MaplibreX v0.1.0)

Copy Markdown View Source

Attribution control component for MapLibre maps in Phoenix LiveView.

This component adds an attribution control that displays map attribution information in a customizable format.

Examples

Basic attribution control:

<.attribution_control
  id="attribution-1"
  map_id="my-map"
  position="bottom-right"
/>

With compact mode disabled:

<.attribution_control
  id="attribution-1"
  map_id="my-map"
  position="bottom-left"
  compact={false}
/>

With custom attribution:

<.attribution_control
  id="attribution-1"
  map_id="my-map"
  position="bottom-right"
  custom_attribution="© My Company 2024 | Custom Data Provider"
/>

Notes

  • The attribution control automatically displays attribution from the map style and sources
  • Custom attribution can be added to supplement the automatic attribution
  • In compact mode, the attribution is collapsed to an info icon that expands on hover/click
  • This is a display-only control with no user events

Position

The control can be positioned in any corner of the map:

  • "top-left"
  • "top-right"
  • "bottom-left"
  • "bottom-right" (default)

Summary

Functions

Renders an attribution control component.

Functions

attribution_control(assigns)

Renders an attribution control component.

Attributes

  • id (required) - Unique identifier for the control
  • map_id (required) - ID of the map to attach to
  • position - Position of the control. One of: ["top-left", "top-right", "bottom-left", "bottom-right"]. Defaults to "bottom-right"
  • compact - If true, displays attribution in compact mode (collapsed). Defaults to true
  • custom_attribution - Additional custom attribution text to display (optional)

Attributes

  • id (:string) (required)
  • map_id (:string) (required)
  • position (:string) - Defaults to "bottom-right". Must be one of "top-left", "top-right", "bottom-left", or "bottom-right".
  • compact (:boolean) - Defaults to true.
  • custom_attribution (:string) - Defaults to nil.