You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
joseph.leach 1d3d79677f 1.1.5 4 years ago
example Working example. 4 years ago
src make close icon align right... 4 years ago
.babelrc Don't need @babel/preset-typescript. 5 years ago
.eslintignore Reorder import. 4 years ago
.eslintrc.json Fix typo. 5 years ago
.gitignore Next example added. CRA demo deleted. 4 years ago
.prettierignore eslintrc edits. 5 years ago
.prettierrc First commit. 5 years ago
LICENSE Initial commit 5 years ago
README.md test commit 4 years ago
package-lock.json 1.1.5 4 years ago
package.json 1.1.5 4 years ago
rollup.config.js Re-introduced Peer Deps External plugin to 5 years ago
tsconfig.json Added typescript-eslint. 5 years ago
what-this-looks-like.gif Updated gif. 5 years ago
yarn.lock Working example. 4 years ago

README.md

react-mui-mapbox-geocoder

A Material UI Autosuggest'ing Mapbox Geocoder for locating addresses and points of interest.

What Is This?

basically it is a combination of...

@mapbox/react-geocoder

and

material-ui & react-autosuggest

What Does This Component Look Like?

it looks like this...

What does this component look like?

How Can I Use It?

Here are some hints...

import MatGeocoder from 'react-mui-mapbox-geocoder'

...

const geocoderApiOptions = {
  country: 'us',
  proximity: {longitude: -121.0681, latitude: 38.9197},
  bbox: [-123.8501, 38.08, -117.5604, 39.8735]
}

const onSelectHandler = (result) => {
  // Go to result handler.
}


return (
  ...
  <MatGeocoder
    inputPlaceholder="Search Address"
    accessToken={MAPBOX_TOKEN}
    onSelect={onSelectHandler}
    showLoader={true}
    {...geocoderApiOptions}
  />
)

...

Are There Any Other Props I Can Pass?

Yes.

endpoint: string, default "'https://api.mapbox.com'"
source: string, default "'mapbox.places'"
inputPlaceholder: string, default "'Search'"
accessToken: (required) string
proximity: (optional) {longitude: number, latitude: number}
country: (optional) string, eg. 'us'
bbox: (optional) [number, number, number, number]
types: (optional) string,
limit: (optional) number,
autocomplete: (optional) boolean
language: (optional) string,
showLoader: boolean, default "true"
focusOnMount: boolean, default "false"
onSelect: (required), (selectedFeature) => {...},
onSuggest: (optional), (suggestedResults) => {...}

See Mapbox API Docs for more information.