1.6.1 • Published 3 years ago

algolia-places-react v1.6.1

Weekly downloads
2,932
License
MIT
Repository
github
Last release
3 years ago

React wrapper for Algolia Places codecovKnown VulnerabilitiesBuild Status

Blazing fast address autocomplete React/preact component. :zap:

Demo

Checkout the demo at https://address-autocomplete-react.netlify.com/ Demo GIF

Installation

npm install algolia-places-react --save

or

yarn add algolia-places-react

Usage

import React from 'react';
import AlgoliaPlaces from 'algolia-places-react';

export default () => {
  return (
    <AlgoliaPlaces
      placeholder='Write an address here'

      options={{
        appId: 'my-app-id',
        apiKey: 'sharing-is-caring',
        language: 'sv',
        countries: ['se'],
        type: 'city',
        // Other options from https://community.algolia.com/places/documentation.html#options
      }}

      onChange={({ query, rawAnswer, suggestion, suggestionIndex }) => 
        console.log('Fired when suggestion selected in the dropdown or hint was validated.')}

      onSuggestions={({ rawAnswer, query, suggestions }) => 
        console.log('Fired when dropdown receives suggestions. You will receive the array of suggestions that are displayed.')}

      onCursorChanged={({ rawAnswer, query, suggestion, suggestonIndex }) => 
        console.log('Fired when arrows keys are used to navigate suggestions.')}

      onClear={() => 
        console.log('Fired when the input is cleared.')}

      onLimit={({ message }) => 
        console.log('Fired when you reached your current rate limit.')}

      onError={({ message }) => 
        console.log('Fired when we could not make the request to Algolia Places servers for any reason but reaching your rate limit.')}
    />
  );  
}

Full API documentation

Live examples

Todo

1.6.1

3 years ago

1.6.0

4 years ago

1.5.1

4 years ago

1.5.0

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago