react-address-autocomplete-list
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

Certainly! Here’s a basic README.md file for your ReactAddressAutoComplete component. This file includes sections for installation, usage, and basic API documentation.

mar

ReactAddressAutoComplete

ReactAddressAutoComplete is a React component for providing address auto-completion using the Google Places API. It allows users to type and select addresses with suggestions based on the input query.

Installation

To use this component, first ensure you have the required dependencies:

  1. React: This component is built for React. Make sure you have React installed in your project.
  2. Fetch: For making API requests, ensure you have a fetch polyfill if you are supporting older browsers. Modern browsers have fetch natively.

Install the component via npm or yarn:

npm install react-address-autocomplete-list

or

yarn add react-address-autocomplete-list

Usage

To use ReactAddressAutoComplete in your project, import and include it in your component. You need to provide a Google API key with the Places API enabled.
import React from 'react';
import {ReactAddressAutoComplete} from 'react-address-autocomplete-list
';

const App = () => {
  const googleKey = 'YOUR_GOOGLE_API_KEY';

  return (
    <div>
      <h1>Address AutoComplete</h1>
      <ReactAddressAutoComplete
        useGoogle={true}
        googleKey={googleKey}
        country="us"
        state="ca"
      />
    </div>
  );
};

export default App;

##Props Required useGoogle (boolean): Determines if Google Places API should be used. Set to true to enable Google API integration. googleKey (string): Your Google API key for accessing the Places API. Optional country (string): Optional. Country code (e.g., 'us') to restrict the search results to a specific country. state (string): Optional. State code (e.g., 'ca' for California) to restrict the search results to a specific state. keyword (string): Optional. Keyword for filtering the places. type (string): Optional. Type filter (e.g., 'locality', 'establishment') to filter places by type. location (object): Optional. Latitude and longitude for the search center. lat (number): Latitude. lng (number): Longitude. radius (number): Optional. Radius in meters to restrict the search results. rankby ('distance' | 'prominence'): Optional. Ranking method for the search results. inputProps (object): Optional. Additional properties for the input element, such as onChange. Methods

handleSearch: Triggers the search for address suggestions based on the current input query. handleSelect: Selects an address from the suggestions and updates the input value. Styling

The component uses inline styles. You can customize the styles by modifying the JavaScript objects defined in the component or by overriding styles with additional CSS.

Contributing

If you’d like to contribute to the development of this component, please follow these guidelines:

Fork the repository. Create a new branch for your feature or bug fix. Make your changes. Submit a pull request with a clear description of your changes. License

This component is licensed under the MIT License. See the LICENSE file for more details.

Contact

For any questions or feedback, please contact nilesh0109choubisa@gmail.com

mar

Key Sections

  • Installation: Instructions for installing the component via npm or yarn.
  • Usage: Basic example of how to use the component.
  • Props: Detailed description of each prop the component accepts.
  • Methods: Overview of the main methods used internally.
  • Styling: Information about styling and customization.
  • Contributing: Guidelines for contributing to the development of the component.
  • License: Licensing information for the component.
  • Contact: Your contact information for further inquiries.

Feel free to adjust the sections to better fit your project needs or to add more details as necessary.

Readme

Keywords

none

Package Sidebar

Install

npm i react-address-autocomplete-list

Weekly Downloads

3

Version

1.0.8

License

MIT

Unpacked Size

32.2 kB

Total Files

9

Last publish

Collaborators

  • nilsackerman