3.0.0 • Published 10 months ago

react-country-dropdown v3.0.0

Weekly downloads
104
License
MIT
Repository
github
Last release
10 months ago

react-country-dropdown

A simple react country selection dropdown component.

No external dependencies, just a clean functional component.

npm npm

Demo Screenshot

Install

npm i react-country-dropdown

Usage

Check the full documentation and demo here.

import ReactCountryDropdown from "react-country-dropdown";

const Example = () => {
	return (
		<ReactCountryDropdown
			defaultCountry="JP"
			onSelect={(country) => console.log(country.name)}
		/>
	);
};

API

The <ReactCountryDropdown/> component accepts only two props.

Props:

NameTypeRequiredDefaultDescription
defaultCountrystringYesnullThe default country code to be selected.
onSelectfuncYesnullCallback function when a country is selected. Returns the country object.

Country Object:

{
	"name": "Japan",
	"code": "JP",
	"code2": "JPN",
	"capital": "Tokyo",
	"region": "Asia",
	"citizen": "Japanese",
	"flagUrl": "https://flagcdn.com/jp.svg",
	"callingCodes": ["81"],
	"timezones": ["UTC+09:00"],
	"latlng": [36, 138],
	"currencies": [{ "code": "JPY", "name": "Japanese yen", "symbol": "¥" }]
}

License

MIT © 2024 Rocktim Saikia

3.0.0

10 months ago

2.2.0

10 months ago

2.1.0

10 months ago

2.0.1

10 months ago

2.0.0

10 months ago

1.1.1

1 year ago

1.1.0

2 years ago

1.0.2

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago