Installations
npm install react-select-country-list
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
14.15.1
NPM Version
6.14.8
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
Chun-Lin
Download Statistics
Total Downloads
5,294,164
Last Day
7,358
Last Week
32,126
Last Month
146,511
Last Year
1,777,758
GitHub Statistics
54 Stars
38 Commits
37 Forks
6 Watching
1 Branches
3 Contributors
Bundle Size
19.33 kB
Minified
4.58 kB
Minified + Gzipped
Package Meta Information
Latest Version
2.2.3
Package Id
react-select-country-list@2.2.3
Unpacked Size
35.56 kB
Size
8.16 kB
File Count
6
NPM Version
6.14.8
Node Version
14.15.1
Total Downloads
Cumulative downloads
Total Downloads
5,294,164
Last day
-3.8%
7,358
Compared to previous day
Last week
-18.7%
32,126
Compared to previous week
Last month
3%
146,511
Compared to previous month
Last year
19.3%
1,777,758
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
3
react-select-country-list
This package take country-list as reference, and make it more friendly to react-select
Maps ISO 3166-1-alpha-2 codes to English country names and match react-select options props.
Uses data from https://www.iso.org/iso-3166-country-codes.html
Install
1npm install react-select-country-list --save
or
1yarn add react-select-country-list
Example
1import React, { useState, useMemo } from 'react' 2import Select from 'react-select' 3import countryList from 'react-select-country-list' 4 5function CountrySelector() { 6 const [value, setValue] = useState('') 7 const options = useMemo(() => countryList().getData(), []) 8 9 const changeHandler = value => { 10 setValue(value) 11 } 12 13 return <Select options={options} value={value} onChange={changeHandler} /> 14} 15 16export default CountrySelector 17
Methods
All input is case-insensitive.
getValue(label)
Expects the English country name.
Returns the code for that country.
If not found, it returns undefined
.
getLabel(value)
Expects a two-digit country code.
Returns the name for that country.
If not found, it returns undefined
.
getValues()
Returns an array of all country codes.
getLabels()
Returns an array of all country names.
getValueList()
Returns a key-value object of all countries using the code as key.
getLabelList()
Returns a key-value object of all countries using the name as key.
getData()
Returns an array of all country information, in the same format as it gets imported.
setLabel(value, label)
Due to different perspectives among different regions, this method can help developers customize the label of specific country. What's more, it can be chained with another methods above.
Usage
1// Make 'Viet Nam' -> 'Vietnam' 2countries.setLabel('VN', 'Vietnam').getLabel('VN') // 'Vietnam'
setEmpty(label)
You may want an empty value option in the list, so here's the helper function for you. Again, it can be chained with another methods above.
Usage
1countries.setEmpty('Select a Country').getLabel('') // 'Select a Country'
We can even chain setLabel
and setEmpty
together to have list with an empty option and the modified label.
1countries.setLabel('VN', 'Vietnam').setEmpty('Select a Country').getLabel('VN') // 'Vietnam'
native()
You may want to display native name of countries, this is the method for you. The data source of native names can be found here
Usage
1countries.native().getLabel('TW') // 臺灣
License
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 3/28 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 5 are checked with a SAST tool
Reason
48 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-832h-xg76-4gv6
- Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx
- Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9
- Warn: Project is vulnerable to: GHSA-q42p-pg8m-cqh6
- Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9
- Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f
- Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p
- Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv
- Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8
- Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65
- Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh
- Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44
- Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988
- Warn: Project is vulnerable to: GHSA-44pw-h2cw-w3vq
- Warn: Project is vulnerable to: GHSA-jp4x-w63m-7wgm
- Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546
- Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-282f-qqgm-c34q
- Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm
- Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574
- Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm
- Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-w9mr-4mfr-499f
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-6g33-f262-xjp4
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-xc7v-wxcw-j472
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
- Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp
Score
1.9
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to react-select-country-list
@types/react-select-country-list
TypeScript definitions for react-select-country-list
@harcorp/react-select-country-list
Maps ISO 3166-1-alpha-2 codes to English country names and match react-select options props
react-country-state-city
A lightweight and easy-to-use React library that provides a comprehensive list of regions or continents, countries, states, cities languages, and country phone codes for creating dynamic and searchable dropdowns. Ideal for building forms and input fields
dky-select-country-list
Select Country List for React JS