--- layout: api title: "v1.6.0 API: L.mapbox.shareControl(id|url, options)" categories: api version: v1.6.0 permalink: /api/v1.6.0/l-mapbox-sharecontrol --- {% raw %}

## L.mapbox.shareControl(id|url, options)

Adds a "Share" button to the map, which can be used to share the map to Twitter or Facebook, or generate HTML for a map embed.

Extends: L.Control

Options | Value | Description
--- | --- | ---
id or url optional | string | Either a `id` string `examples.map-foo` A URL to TileJSON, like `https://a.tiles.mapbox.com/v3/examples.map-0l53fhk2.json` If not supplied, the TileJSON from the map is used.
options | object | Options for L.Control Also accepts the following options: url: the `URL` of a page to which the share control will link instead of the URL of the current page or that specified in TileJSON data.

Example:

    var map = L.map('map', 'examples.map-i875kd35')
        .setView([37, -77], 5)
        .addControl(L.mapbox.shareControl());

Returns: Returns a `L.mapbox.shareControl` object.

{% endraw %}