Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-select

Package Overview
Dependencies
Maintainers
7
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-select

Everything you wish the HTML <select> element could do, wrapped up into a lightweight, extensible Vue component.

  • 3.20.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
174K
decreased by-28.84%
Maintainers
7
Weekly downloads
 
Created

What is vue-select?

vue-select is a Vue.js component that provides a customizable, single or multi-select dropdown with search functionality. It is designed to be flexible and easy to integrate into Vue applications, offering a range of features to enhance user experience.

What are vue-select's main functionalities?

Basic Usage

This code demonstrates the basic usage of vue-select, where a simple dropdown with predefined options is created.

<template>
  <v-select :options="['Option 1', 'Option 2', 'Option 3']"></v-select>
</template>

<script>
import vSelect from 'vue-select'

export default {
  components: { vSelect }
}
</script>

Custom Options

This example shows how to use custom objects as options in the dropdown, specifying a label to display.

<template>
  <v-select :options="options" label="name"></v-select>
</template>

<script>
import vSelect from 'vue-select'

export default {
  components: { vSelect },
  data() {
    return {
      options: [
        { id: 1, name: 'Option 1' },
        { id: 2, name: 'Option 2' },
        { id: 3, name: 'Option 3' }
      ]
    }
  }
}
</script>

Multi-Select

This code demonstrates how to enable multi-select functionality, allowing users to select multiple options from the dropdown.

<template>
  <v-select :options="['Option 1', 'Option 2', 'Option 3']" multiple></v-select>
</template>

<script>
import vSelect from 'vue-select'

export default {
  components: { vSelect }
}
</script>

Searchable Dropdown

This example shows how to enable the search functionality within the dropdown, allowing users to filter options by typing.

<template>
  <v-select :options="['Option 1', 'Option 2', 'Option 3']" searchable></v-select>
</template>

<script>
import vSelect from 'vue-select'

export default {
  components: { vSelect }
}
</script>

Async Options

This code demonstrates how to load options asynchronously, which is useful for fetching data from an API based on user input.

<template>
  <v-select :options="fetchOptions" :reduce="option => option.id"></v-select>
</template>

<script>
import vSelect from 'vue-select'

export default {
  components: { vSelect },
  methods: {
    fetchOptions(search, loading) {
      loading(true);
      setTimeout(() => {
        loading(false);
        return [
          { id: 1, name: 'Option 1' },
          { id: 2, name: 'Option 2' },
          { id: 3, name: 'Option 3' }
        ];
      }, 1000);
    }
  }
}
</script>

Other packages similar to vue-select

FAQs

Package last updated on 03 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc