react-country-dropdown
Advanced tools
Comparing version 2.2.0 to 3.0.0
@@ -20,3 +20,3 @@ type Currency = { | ||
interface Props { | ||
defaultCountry?: string; | ||
defaultCountry: string; | ||
onSelect: (country: ICountry) => void; | ||
@@ -23,0 +23,0 @@ } |
{ | ||
"name": "react-country-dropdown", | ||
"version": "2.2.0", | ||
"version": "3.0.0", | ||
"description": "A simple react country selection dropdown component", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -27,4 +27,4 @@ # react-country-dropdown | ||
<ReactCountryDropdown | ||
defaultCountry="JP" | ||
onSelect={(country) => console.log(country.name)} | ||
defaultCountry="JP" | ||
/> | ||
@@ -35,4 +35,33 @@ ); | ||
## API | ||
The `<ReactCountryDropdown/>` component accepts only two props. | ||
### Props: | ||
| Name | Type | Required | Default | Description | | ||
| ---------------- | ------ | -------- | ------- | ------------------------------------------------------------------------- | | ||
| `defaultCountry` | string | Yes | `null` | The default country code to be selected. | | ||
| `onSelect` | func | Yes | `null` | Callback function when a country is selected. Returns the country object. | | ||
#### Country Object: | ||
```json | ||
{ | ||
"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](./LICENSE) © 2024 [Rocktim Saikia](https://github.com/rocktimsaikia) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
234071
66