npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

vue-state-dropdown

v1.0.10

Published

State Dropdown for Vue@2

Readme

Vue State Dropdown

State dropdown for Vue@2.

Demo

Installation

  • yarn:
      yarn add vue-state-dropdown
  • npm:
      npm i --save vue-state-dropdown

Usage

  • Install as a global component:

    import Vue from "vue";
    import VueStateDropdown from "vue-state-dropdown";
    
    Vue.use(VueStateDropdown);
  • Or use in a specific component

    import VueStateDropdown from 'vue-state-dropdown'
    
    export default {
      components: {
        VueStateDropdown
      }
    }
  • In your component:

    <template>
    ...
      <vue-state-dropdown
        @onSelect="onSelect"
        :countryCode="'tr'"
        :selectFirstItem="true"
        :preferredStates="['06', '34']"
        :immediateCallSelectEvent="true"
        :disabled="false"
        :clearable="false"
        :multiple="false"
        :searchable="true"
        :closeOnSelect="true"
      />
    ...
    <template>
    <script>
    export default {
      methods: {
         onSelect(state) {
           console.log(state);
           // Check the state object example below.
         },
      },
    }
    </script>

State Object Example

{
  "id": 2217,
  "name": "Ankara",
  "country_id": 225,
  "country_code": "TR",
  "country_name": "Turkey",
  "state_code": "06",
  "type": "province",
  "latitude": "39.78052450",
  "longitude": "32.71813750"
}

Props

| Property value | Type | Default value | Description | | -------------------------- | --------- | ---------------| ---------------------------------------------------------------------------------- | | disabled | Boolean | false | Disables the dropdown | | countryCode | string | '' | Get states by country code. ie 'tr' | | countryName | string | '' | Get states by country name. ie 'turkey' | | countryId | Number | null | Get states by country id. ie 225 | | defaultState | Number | '' | Set a state as selected at startup with state id. ie 2217 | | defaultStateByName | string | '' | Set a state as selected at startup with state name. ie 'Ankara' | | selectFirstItem | Boolean | false | Set first state in the list as selected | | clearable | Boolean | false | User can clear or not the selected country | | multiple | Boolean | false | Select multiple country | | searchable | Boolean | true | Set states searchable | | closeOnSelect | Boolean | true | Close country list on select | | placeholder | String | '' | Set a placeholder for the input | | preferredState | Array | [] | Preferred states list, will be on top of the dropdown. ie ['06', 'WTO'] | | onlyStates | Array | [] | List of states will be shown on the dropdown. ie ['06', 'WTO'] | | ignoredStates | Array | [] | List of states will NOT be shown on the dropdown. ie ['06', 'WTO'] | | immediateCallSelectEvent | Boolean | false | Call the onSelect event when the component is mounted. | | showNotSelectedOption | Boolean | false | The Not Selected option is added to the top of the list. (All values are empty.) | | notSelectedOptionText | String | Not Selected | Replace Not Selected text with another string. |

Events

| Property value | Arguments | Description | | ------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------- | | onSelect | Object | Fires when the input changes with the argument is the object includes state object. (Check the state object example above) | | open | none | Triggered when the dropdown is open. | | close | none | Triggered when the dropdown is closed. | | option_selecting | Object | Triggered after an option has been selected, before updating internal state. (Return same object with onSelect). | | option_selected | Object | Triggered when an option has been selected, after updating internal state. (Return same object with onSelect). | | option_deselecting| Object | Triggered when an option has been deselected, before updating internal state. (Return same object with onSelect). | | option_deselected | Object | Triggered when an option has been deselected, after updating internal state. (Return same object with onSelect). |

Highlights & Credits