@dylmye/mui-google-places-autocomplete
v0.2.12
Published
Google places autocomplete input for MUI library in React.
Downloads
116
Maintainers
Readme
MUI Google Places Autocomplete
React component for easily use Google Places Autocomplete, which uses the MUI React Autocomplete component.
A fork of Nicolas Tinte's brilliant component, which uses react-select.
Warning
This is currently pre-production - don't expect it to work right now.
Getting started
Install the latest version:
npm install --save mui-google-places-autocomplete
or
yarn add mui-google-places-autocomplete
Use the component:
import React from "react";
import GooglePlacesAutocomplete from "@dylmye/mui-google-places-autocomplete";
const Component = () => (
<div>
<GooglePlacesAutocomplete apiKey="****" />
</div>
);
export default Component;
Or with Formik:
import React from "react";
import { Formik, Form, Field } from "formik";
import { GooglePlacesAutocompleteField } from "@dylmye/mui-google-places-autocomplete";
const MyForm = () => (
<Formik onSubmit={console.log}>
<Form>
<Field
name="location"
component={GooglePlacesAutocompleteField}
apiKey="****"
/>
</Form>
</Formik>
);
export default MyForm;
Documentation
How to contribute?
Fork this repo
Clone your fork
Code 🤓
Test your changes
For this, I like to use yalc, as it allows to emulate the process of using npm/yarn.
- Install yalc
- Build project with
yarn build
ornpm run build
- Publish the package with yalc:
yalc publish
- Add the package to your test project
yalc add @dylmye/mui-google-places-autocomplete
- If needed, to update the package on your test project:
yalc update @dylmye/mui-google-places-autocomplete
Submit a PR!