Dynamic and custom react country, state, city select drop-down with flag and phone code options
A Node.js React package that gives dynamic and custom country, state, city select drop down with flag and phone code option. RegionSelect gives the max possible options to use country, state, city select dropdown with diffrent possible combinations of all with optional country flag and phone code options. RegionSelect can be used to show all country name list dropdown and also custom options of country name using its country code like 'IN' for india, 'AS' for American Samoa, 'AU' for australia etc.
The package can be installed via NPM:
npm install react-region-flag-select --save
react-region-flag-select can be imported as follows
var RegionSelect = require('react-region-flag-select');
OR
import RegionSelect from 'react-region-flag-select';
All country Codes Can Be Check Here: Country Codes
<RegionSelect />
handleChangeMethod=(data)=>{
console.log('Result',data);
}
<RegionSelect
handleChange={this.handleChangeMethod}
/>
import React, {Component} from 'react';
import RegionSelect from 'react-region-flag-select';
class App extends Component {
handleChangeMethod=(data)=>{
console.log('Result',data);
}
render() {
return (
<RegionSelect
handleChange={this.handleChangeMethod}
/>
);
}
}
export default App;
<RegionSelect
isFlag={false} />
<RegionSelect
isPhoneCode={false} />
<RegionSelect
isCity={false}/>
<RegionSelect
isState={false} />
<RegionSelect
isState={false}
countryCode={'IN'}/>
<RegionSelect
isCountry={false} />
<RegionSelect
isCountry={false}
countryCode={'IN'}/>
<RegionSelect
countryOnly={true} />
<RegionSelect
countryOnly={true}
selectedCountryCode={'IN'} />
<RegionSelect
stateOnly={true} />
<RegionSelect
stateOnly={true}
countryCode={'IN'} />
<RegionSelect
cityOnly={true} />
<RegionSelect
cityOnly={true}
countryCode={'IN'} />
<RegionSelect
customCountryOnly={true}
customCountryCode={['IN','AS','AU']}/>
<RegionSelect
customCountryOnly={true}
customCountryCode={['IN','AS','AU']}
selectedCountryCode={'IN'} />
{"countryData":
{
"data": {
"id": 101,"sortname":"IN","name":"India","phoneCode":91
}
},
"stateData":{
"data": {
"id": "10","name":"Delhi","country_id":"101"
}
},
"cityData":{
"data": {
"id": "707","name":"New Delhi","state_id":"10"
}
}
}
isFlag: true,
isPhoneCode: true,
customCountryCode: [],
countryCode: '',
stateOnly: false,
countryOnly: false,
cityOnly: false,
customCountryOnly: false,
isCity: true,
isState: true,
isCountry: true,
selectedCountryCode: ''
isFlag: Boolean,
isPhoneCode: Boolean,
customCountryCode: [],
countryCode: String,
stateOnly: Boolean,
countryOnly: Boolean,
cityOnly: Boolean,
customCountryOnly: Boolean,
isCity: Boolean,
isState: Boolean,
isCountry: Boolean,
selectedCountryCode: String,
handleChange: Function
MIT Licensed. Copyright (c) Gaurav Tanwar 2019.