> For the complete documentation index, see [llms.txt](https://docs.mapbox.com/mapbox-search-js/llms.txt)

# Minimap

**Minimap** provides a UI that allows users to confirm a physical location on a map, reducing delivery errors in both shipping and local dispatching contexts.

This page includes reference documentation for the `MapboxAddressMinimap` class, functions, and types in the **Mapbox Search JS Web** framework.

## Class

### MapboxAddressMinimap

`MapboxAddressMinimap` is a class that displays a marker on a map for confirmation purposes.

Instantiating it produces a DOM element that you append into any container; set the `feature` property to display a marker for that location.

Optionally, this marker is editable. When editable, the marker can be moved around the map and the updated location is sent back to the Mapbox Contribute workflow.

The goal of `MapboxAddressMinimap` is to reduce delivery or geolocation error in shipping and local dispatching contexts.

`MapboxAddressMinimap` expands to fill its container, and is hidden unless [MapboxAddressMinimap#feature](#mapboxaddressminimap#feature) is truthy. Setting [MapboxAddressMinimap#feature](#mapboxaddressminimap#feature) to `null` hides the component.

To use this class, you must have a [Mapbox access token](https://www.mapbox.com/help/create-api-access-token/). Set the token directly on the instance via `accessToken`, set it globally via [`config.accessToken`](https://docs.mapbox.com/mapbox-search-js/api/web/config/#config), or — when used inside a [`confirmAddress()`](https://docs.mapbox.com/mapbox-search-js/api/web/autofill/#confirmaddress) call — let the confirmation dialog pass its token through automatically.

> new MapboxAddressMinimap()

#### Import[​](#import)

```javascript
import { MapboxAddressMinimap } from '@mapbox/search-js-web'
```

#### Example

```js
const minimap = new MapboxAddressMinimap();
minimap.accessToken = 'YOUR_MAPBOX_ACCESS_TOKEN';
containerElement.appendChild(minimap);
minimap.feature = {
  type: 'Feature',
  geometry: {
    type: 'Point',
    coordinates: [-122.4194, 37.7749]
  },
  properties: {}
};
```

#### Instance Members

### Markers

##### canAdjustMarker

If `true`, the marker can be moved around the map. Defaults to `false`.

When editable, the marker can be moved around the map and the updated location can be referenced from the [MapboxAddressMinimap#onSaveMarkerLocation](#mapboxaddressminimap#onsavemarkerlocation) callback.

###### Type

[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)

##### keepMarkerCentered

If `true`, the map when panned moves around the marker, keeping the marker centered. Defaults to `false`.

###### Type

[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)

##### markerAnchor

The anchor of the marker, relative to center of the expanded size. Defaults to `'bottom'`.

###### Type

[Anchor](#anchor)

##### onSaveMarkerLocation

A client-defined callback that is triggered when the "Save" button is clicked in the editing interface, and gives access to the adjusted marker coordinate.

###### Type

[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)

### Input data

##### accessToken

The [Mapbox access token](https://docs.mapbox.com/help/glossary/access-token/) to use for all requests.

If not explicitly set on the component, this will reference the value in the global config object.

###### Example

```js
minimap.accessToken = 'pk.my-mapbox-access-token';
```

##### feature

A [GeoJSON](https://docs.mapbox.com/help/glossary/geojson/) Feature representing a [Point](https://geojson.org/geojson-spec.html#point) geometry.

The minimap is hidden unless [MapboxAddressMinimap#feature](#mapboxaddressminimap#feature) is truthy. Setting [MapboxAddressMinimap#feature](#mapboxaddressminimap#feature) to `null` hides the component.

###### Type

Feature

### Appearance

##### satelliteToggle

If `true`, the map will have an image toggle between Map and Satellite styles.

###### Type

[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)

##### theme

The [Theme](https://docs.mapbox.com/mapbox-search-js/mapbox-search-js/api/web/theming/#theme) to use for styling the editing interface.

`theme.cssText` selectors may target: `.MapboxAddressMinimap`, `.MinimapImageContainer`, `.MinimapImage`, `.MinimapInnerFrame`, `.MinimapMarker`, `.MinimapAttribution`, `.MinimapAttributionLogo`, `.MinimapAttributionText`, `.MinimapStyleToggle`, `.MinimapFooter`, `.MinimapEditButtons`, `.Button`, `.ButtonPrimary`, `.MinimapButtonAdjust`, `.MinimapButtonSave`, `.MinimapButtonCancel`.

###### Type

[Theme](https://docs.mapbox.com/mapbox-search-js/mapbox-search-js/api/web/theming/#theme)

###### Example

```js
minimap.theme = {
  variables: {
    colorPrimary: 'myBrandRed'
  },
  cssText: ".MinimapInnerFrame:hover { border: 5px solid lightskyblue; }"
};
```

##### adjustBtnText

Custom adjust button text appearing on the map. If not provided, the default text will be used.

###### Type

[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)

##### saveBtnText

Custom save button text appearing on the map, when marker adjustment is enabled. If not provided, the default text will be used.

###### Type

[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)

##### cancelBtnText

Custom cancel button text appearing on the map, when marker adjustment is enabled. If not provided, the default text will be used.

###### Type

[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)

##### mapStyleMode

The map style to use, either `'default'` or `'satellite'`. The default map style is configurable with [MapboxAddressMinimap#defaultMapStyle](#mapboxaddressminimap#defaultmapstyle).

###### Type

(`"default"` \| `"satellite"`)

##### defaultMapStyle

The map style to use for the default map style. Defaults to `['mapbox', 'streets-v11']`.

###### Type

[[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)]

##### footer

Custom footer text appearing below the map, when marker adjustment is enabled. If `true` or left undefined, the default footer text will be used. If `false`, the footer will not be shown.

###### Type

([boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean) \| [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))

### Methods

##### show()

If [MapboxAddressMinimap#feature](#mapboxaddressminimap#feature) is truthy, show the minimap.

###### Returns

void

##### hide()

Hide the minimap.

###### Returns

void

Was this section on MapboxAddressMinimap helpful?[Yes](null)[No](null)

## Options and Type Definitions

### Anchor

Valid strings for setting `markerAnchor` on [MapboxAddressMinimap](#mapboxaddressminimap)

#### Type

(`"center"` \| `"top-left"` \| `"top-right"` \| `"bottom-left"` \| `"bottom-right"` \| `"top"` \| `"bottom"` \| `"left"` \| `"right"`)

Was this section on Anchor helpful?[Yes](null)[No](null)