1.0.4 • Published 11 months ago

@abhisek_goldy/react-address-picker v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

@abhisek_goldy/react-address-picker 🚀

npm version downloads license

React Library for Country, State, City and Phone code

Installation 📦

To install this package, run:

npm install @abhisek_goldy/react-address-picker

or with yarn:

yarn add @abhisek_goldy/react-address-picker

Usage 💡

Here's how you can use this package:

Example Country

import AddressPicker from "react-address-picker";

<AddressPicker
    type="country" //required
    placeholder="Search for a Country..." //optional
    value="India" //optional
    onChange={(obj) => console.log(obj?.id)} //optional
/>

Example State

<AddressPicker
    type="state" //required
    placeholder="Search for a State..." //optional
    onChange={(obj)=> console.log(obj?.id)} //optional
/>

Example City

<AddressPicker
    type="city"
    placeholder="Search for a State..." //optional
    onChange={(obj)=> console.log(obj?.id)} //optional
/>

Example Phone code

<AddressPicker
    type="code"
    placeholder="Search for a Phone code..." //optional
    onChange={(obj) => console.log(obj)}
/>

Props 🛠️

Below are the props supported by this component:

NameTypeDefault ValueRequired?
typestringnullYes
valuestringnullNo
placeholderstring"Search for a.."No
emptyStringstringNo Record FoundNo

Function 🛠️

Below are the props function supported by this component:

onChange

onChange={(val)=>console.log(val)}

Style 🛠️

NameTypeDefault ValueRequired?
containerStyleobjectnullNo
inputStyleobjectnullNo
itemStyleobjectnullNo
containerClassNamestring | No
dropdownContainerClassNamestring | No
inputClassNamestring | No
itemClassNamestring | No

License 📝

This project is licensed under the MIT License.

Authors ✍️

Abhisek Goldy - Creator and Maintainer.

Support ❤️ If you like this project, please consider giving it a ⭐ on GitHub!