Giter Site home page Giter Site logo

caceres97 / algolia-places-react Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kontrollanten/algolia-places-react

0.0 1.0 0.0 7.07 MB

React/preact wrapper for Algolia Places

Home Page: https://npm.im/algolia-places-react

License: MIT License

JavaScript 98.11% HTML 1.89%

algolia-places-react's Introduction

Looking for maintainer. Contact [email protected] if you're interested.

React wrapper for Algolia Places codecovKnown VulnerabilitiesBuild Status

Blazing fast address autocomplete React/preact component. โšก

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

algolia-places-react's People

Contributors

renovate-bot avatar kontrollanten avatar samjetski avatar dpikt avatar erikaugust avatar caceres97 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.