JSPM

address-autocomplete-react

1.0.3
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 8
    • Score
      100M100P100Q39245F
    • License MIT

    Address autocomplete - A package for inputbox with autocomplete/autosuggest feature to allow users to search address across the globe. Using Photon / komoot geocoder for autocomplete. This is a React component that provides an autosuggest input box using the Photon API for location search with OpenStreetMap data. It returns the selected location's name and coordinates.

    Package Exports

    • address-autocomplete-react
    • address-autocomplete-react/dist/index.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (address-autocomplete-react) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    react-photon-location-input

    This is a React component that provides an autosuggest input box using the Photon API for location search with OpenStreetMap data. It returns the selected location's name and coordinates.

    Installation

    Install the component via npm:

    npm install address-autocomplete-react

    LiveDemo

    Click here to see it in action

    Usage

    import React, { useState } from "react";
    import LocationInput from "address-autocomplete-react";
    
    const MyApp = () => {
      const [coords, setCoords] = useState(null);
    
      const handleLocationSelect = (location) => {
        setCoords([location.lat, location.lon]);
        console.log("Selected location:", location);
      };
    
      return (
        <div>
          <LocationInput
            placeholder="Enter Drop Location..."
            onLocationSelect={handleLocationSelect}
          />
          {coords && <p>Selected coordinates: {coords.join(", ")}</p>}
        </div>
      );
    };
    
    export default MyApp;