Skip to main content

Search Box

Public beta for Mapbox Search JS
Mapbox Search JS is in public beta. During the public beta phase, frameworks may be subject to potential changes as they stabilize.

Search Box provides a rich UI for single-box location search, allowing your users to search for addresses and points of interest by place name, address, or category.

This page includes reference documentation for the MapboxSearchBox element, a part of the Mapbox Search JS Web framework.

For installation instructions and a helpful introduction to using Search Box in your website or app, see our Web Search Box Quickstart Guide.

HTML Custom Element

MapboxSearchBox

MapboxSearchBox, also available as the element <mapbox-search-box>, is an element that lets you search for places, addresses, and landmarks using the Mapbox Search Box API.

It can control a Mapbox GL JS map to zoom to the selected result.

Additionally, MapboxSearchBox implements the IControl interface.

To use this element, you must have a Mapbox access token.

new MapboxSearchBox()

Example

const search = new MapboxSearchBox();
search.accessToken = 'YOUR_MAPBOX_ACCESS_TOKEN';
map.addControl(search);
<mapbox-search-box
access-token="YOUR_MAPBOX_ACCESS_TOKEN"
proximity="0,0"
>
</mapbox-search-box>

Instance Members

Map settings

Methods

Map binding

Events

Was this section on MapboxSearchBox helpful?
Was this page helpful?