Socket
Socket
Sign inDemoInstall

vue-multiselect

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-multiselect

Multiselect component for vue.js


Version published
Weekly downloads
230K
decreased by-19.24%
Maintainers
1
Weekly downloads
 
Created

What is vue-multiselect?

vue-multiselect is a powerful and flexible Vue.js component for creating dropdowns with multi-select capabilities. It supports single and multiple selections, tagging, filtering, and custom rendering of options.

What are vue-multiselect's main functionalities?

Single Select

This feature allows users to select a single option from a dropdown list. The `multiple` prop is set to `false` to enable single selection.

<template>
  <multiselect v-model="selected" :options="options" :multiple="false"></multiselect>
</template>

<script>
import Multiselect from 'vue-multiselect';

export default {
  components: { Multiselect },
  data() {
    return {
      selected: null,
      options: ['Option 1', 'Option 2', 'Option 3']
    };
  }
};
</script>

Multiple Select

This feature allows users to select multiple options from a dropdown list. The `multiple` prop is set to `true` to enable multiple selections.

<template>
  <multiselect v-model="selected" :options="options" :multiple="true"></multiselect>
</template>

<script>
import Multiselect from 'vue-multiselect';

export default {
  components: { Multiselect },
  data() {
    return {
      selected: [],
      options: ['Option 1', 'Option 2', 'Option 3']
    };
  }
};
</script>

Tagging

This feature allows users to add new options (tags) to the dropdown list. The `taggable` prop is set to `true`, and the `@tag` event is used to handle the addition of new tags.

<template>
  <multiselect v-model="selected" :options="options" :taggable="true" @tag="addTag"></multiselect>
</template>

<script>
import Multiselect from 'vue-multiselect';

export default {
  components: { Multiselect },
  data() {
    return {
      selected: [],
      options: ['Option 1', 'Option 2', 'Option 3']
    };
  },
  methods: {
    addTag(newTag) {
      this.options.push(newTag);
      this.selected.push(newTag);
    }
  }
};
</script>

Custom Option Rendering

This feature allows users to customize the rendering of options in the dropdown list. The `custom-label` prop is used to define a method that returns a custom label for each option.

<template>
  <multiselect v-model="selected" :options="options" :custom-label="customLabel"></multiselect>
</template>

<script>
import Multiselect from 'vue-multiselect';

export default {
  components: { Multiselect },
  data() {
    return {
      selected: null,
      options: [
        { name: 'Option 1', id: 1 },
        { name: 'Option 2', id: 2 },
        { name: 'Option 3', id: 3 }
      ]
    };
  },
  methods: {
    customLabel(option) {
      return `${option.name} (ID: ${option.id})`;
    }
  }
};
</script>

Other packages similar to vue-multiselect

FAQs

Package last updated on 04 Oct 2016

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