2.0.0 • Published 5 years ago

react-select-cities v2.0.0

Weekly downloads
41
License
-
Repository
github
Last release
5 years ago

React-Select-Cities

This package built on react-select to select cities, countries, regions, ..etc.

Installation and usage

NPM

You can install it using npm

npm install react-select-cities

then use it in your app like this:

import React, { useState } from 'react';
import ReactSelect from 'react-select-cities';

function App() {
  const [inputValue, setValue] = useState("");

  return (
    <div className="App">
        <ReactSelect
          maxCountriesNumber={5}
          onInputChange={value => {
            const inputValue = value.replace(/\W/g, "");
            setValue(inputValue);
            return inputValue;
          }}
          inputValue={inputValue}
          onChange={(a, b) => {
            console.log("from Parent: ", a, b);
          }}
        />
    </div>
  );
}

export default App;

Props

PropTypeUsageNote
maxCountriesNumberNumberThe maximum number of countries you can select.you can select any number of cities/regions/zipcode under those countries, but you can't add another country.
onInputChangeFunctionfires when you change the input value.(inputValue) => { return inputValue;}
inputValueStringThe input value you enteredyou can manage it using state
onChangeFunctionFires when the value of cities changed(currentSelectedCities, lastAction) => {}

All the previous props are required and you have to set them.

2.0.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago