Gathering detailed insights and metrics for vue3-country-region-select-mod
Gathering detailed insights and metrics for vue3-country-region-select-mod
A vue 3 country select and a vue 3 region select component that is very easy to use and the region select will update automatically depending on your country selected. They can also be used stand alone. This repo is a fork of the original Vue-Country-Region-Select module for Vue 2.
npm install vue3-country-region-select-mod
Typescript
Module System
Node Version
NPM Version
54.3
Supply Chain
97.4
Quality
76.9
Maintenance
100
Vulnerability
100
License
JavaScript (97.51%)
Vue (2.49%)
Total Downloads
223
Last Day
2
Last Week
5
Last Month
12
Last Year
223
10 Stars
64 Commits
10 Forks
2 Watching
8 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
1.0.4
Package Id
vue3-country-region-select-mod@1.0.4
Unpacked Size
208.85 kB
Size
54.52 kB
File Count
3
NPM Version
8.19.4
Node Version
16.20.2
Publised On
06 Jul 2024
Cumulative downloads
Total Downloads
Last day
0%
2
Compared to previous day
Last week
150%
5
Compared to previous week
Last month
71.4%
12
Compared to previous month
Last year
0%
223
Compared to previous year
Vue3-Country-Region-Select provides a pair of Vue 3 components that will allow you to easily put a country and region dropdown in your project that will work together or standalone. Supports vue-i18n.
This project is a fork of the original Vue-Country-Region-Select for Vue 2 by Justin Gehr. If you are looking for Vue 2 support, that is where you want to look.
Credit goes to Justin Gehr and the other contributors for the creation of the original Vue-Country-Region-Select. This fork just provides compatibility with Vue 3.
Modified based on the pull request from Trouni and Jason Beggs this version changed
npm install vue3-country-region-select --save
Being that these are Vue components you will need to use them inside of Vue.
The Data for the countries and regions are originally taken from: https://www.npmjs.com/package/country-region-data However the data set is now located in this project and is available to be edited to suit more countries and regions as you need.
Here is a sample use case of how you would use vue3-country-region-select in your vue project. You can alternatively store the data in a store somewhere. Country and Region values will be returned in their short code values by default.
Ex. country: 'US' and region: 'IL'
There is a prop that will allow for country to be returned in full instead of in short code version.
The library registers the components globally so only need to import the library once in order to make the components be available throughout your project.
1import { createApp } from "vue"; 2import App from "./App.vue"; 3import vueCountryRegionSelect from "vue3-country-region-select"; 4 5const app = createApp(App); 6app.use(vueCountryRegionSelect); 7app.mount("#app");
1<template> 2 <country-select v-model="country" :country="country" topCountry="US" /> 3 <region-select v-model="region" :country="country" :region="region" /> 4</template>
1export default { 2 name: "MyComponent", 3 data: () => ({ 4 country: "", 5 region: "", 6 }), 7};
Here are the available attributes that can be used with the provided components.
<country-select />
Parameter | Required? | Default | Type | Description |
---|---|---|---|---|
v-model | yes | '' | string | The data binding for your component |
country | yes | '' | string | Make this tied to the same piece of data as v-model |
topCountry | no | '' | string | By providing this value you will tell component what country to put at the top of the dropdown list for easy selection. Make sure to use country short code. So for United states you would provide 'US'. However, if you set countryName to true make sure to also write out full country name when setting a topCountry. In this scenerio United States would be 'United States'. |
countryName | no | false | boolean | By setting this value to true, country names will be output in full instead of using the abbreviated short codes. Make sure to set this true for both country and region if you are using. |
whiteList | no | [] | array | Fill this array with capitalized short codes of the countries you want to appear in the dropdown list. ex: ['US', 'CA', 'MX'] |
blackList | no | [] | array | Fill this array with capitalized short codes of the countries you want to remove from dropdown list. ex: ['US'] |
className | no | '' | string | Class name ex: form-control |
placeholder | no | 'Select Country' | string | The placeholder text for country select |
autocomplete | no | false | boolean | Set to true to enable browser to automatically fill out the country. |
shortCodeDropdown | no | false | boolean | Use this to have dropdown text display as short codes |
usei18n | no | true | boolean | Set to false if using i18n and want to disable for this component |
disablePlaceholder | no | false | boolean | Set to true to make placeholder non-selectable |
removePlaceholder | no | false | boolean | Set to true to remove placeholder all together, this will autoselect first in list automatically |
<region-select />
Parameter | Required? | Default | Type | Description |
---|---|---|---|---|
v-model | yes | '' | string | The data binding for your component |
region | yes | '' | string | Make this tied to the same piece of data as v-model |
country | no | '' | string | This tells the component what country to grab the list of displayed regions from. To have it work in tandem with country component provide it the variable that is tied to the v-model of the country-select component. |
defaultRegion | no | 'US' | string | This allows you to set a default region when choosing not to use the country attribute. It will be set to regions of the United States if not provided. |
countryName | no | false | boolean | Set this to true if you are setting it to true while using Country Select. This is just to help keep the data values in sync. |
regionName | no | false | boolean | Set this to true if you want the v-model to output full region names instead of the default abbreviations. |
whiteList | no | [] | array | Fill this array with capitalized short codes of the regions you want to appear in the dropdown list. ex: ['AL', 'AK', 'WA'] |
blackList | no | [] | array | Fill this array with capitalized short codes of the regions you want to remove from dropdown list. ex: ['AZ'] |
className | no | '' | string | Class name ex: form-control |
placeholder | no | 'Select Region' | string | The placeholder text for region select |
autocomplete | no | false | boolean | Set to true to enable browser to automatically fill out the region. |
shortCodeDropdown | no | false | boolean | Use this to have dropdown text display as short codes |
usei18n | no | true | boolean | Set to false if using i18n and want to disable for this component |
disablePlaceholder | no | false | boolean | Set to true to make placeholder non-selectable, this will cause regions to set to first available when switching countries |
removePlaceholder | no | false | boolean | Set to true to remove placeholder all together, this will autoselect first in list automatically |
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
74 existing vulnerabilities detected
Details
Score
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 More