Material UI Geosuggest
A basic material-ui textfield autosuggest for the Google Maps Places API.Installation
The package can be installed by using npm:npm install material-ui-geosuggest --save
Requirements
You need to includehttps://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY_HERE&libraries=places
script to your project at some point either by using:<script>
tag- External script loader like react-load-script
Ps: Google Map API key can be obtained by following the instructions on Maps Javascript API
Usage
import React, { Component } from 'react';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import MuiGeoSuggest from 'material-ui-geosuggest';
class App extends Component {
render() {
return (
<div className="App">
<MuiThemeProvider>
<MuiGeoSuggest options={{
types: ['(cities)'],
componentRestrictions: {country: "us"}
}}
/>
</MuiThemeProvider>
</div>
);
}
}
export default App;