@vuesimple/vs-select

3.0.7 • Public • Published

Vue Simple Select

🗃 A simple vue select. Perfect for all your select scenarios.

A light weight vue plugin built groundup.

npm npm

forthebadge forthebadge forthebadge forthebadge forthebadge forthebadge


📺 Live Demo

Code Sandbox: Link


🛠 Install

npm i @vuesimple/vs-select

🚀 Usage

<template>
  <vs-select :options="options1"></vs-select>
  <vs-multiselect :options="options1"></vs-multiselect>
</template>

<script>
  import { VsSelect, VsMultiselect } from '@vuesimple/vs-select';

  export default {
    components: {
      VsSelect,
      VsMultiselect,
    },

    data() {
      return {
        options1: ['Derek', 'Ryan', 'BB', 'Chris'],
        options2: [
          { label: 'Derek', value: 'D' },
          { label: 'Ryan', value: 'R' },
          { label: 'BB', value: 'BB' },
          { label: 'Chris', value: 'C' },
        ],
      };
    },
  };
</script>

🌎 CDN

<script src="https://unpkg.com/@vuesimple/vs-select@<version>/dist/vs-select.min.js"></script>
// Main/Entry file
app.use(VsSelect.plugin);
<template>
  <vs-select :options="options1"></vs-select>
  <vs-multiselect :options="options1"></vs-multiselect>
</template>

Nuxt.js

Nuxt Code Snippet

After installation,

  • Create a file /plugins/vs-select.js

    import Vue from 'vue';
    import { VsSelect, VsMultiselect } from '@vuesimple/vs-select';
    
    Vue.component('vs-select', VsSelect);
    Vue.component('vs-multiselect', VsMultiselect);
  • Update nuxt.config.js

    module.exports = {
      ...
      plugins: [
        { src: '~plugins/vs-select', mode: 'client' }
        ...
      ]
    }
  • In the page/ component

    <template>
      <vs-select :options="options1"></vs-select>
      <vs-multiselect :options="options1"></vs-multiselect>
    </template>

⚙ Props

Name Type Default Description
options Array - This can be array or array of objects. ['Tony', 'Bruce'] or [{ label: 'Derek', value: 'D' }],
isSearch Boolean false Searchable select
label String - Label text
placeholder String 'Select' Placeholder text
preselected Array - Preselected items. For array of objects, pass value as array items ex: ['D', 'BB']
disabled Boolean false To disable select box
isError Boolean false To show error in select box
isMenu Boolean false To display like menu dropdown. Available only on vs-select
isCompact Boolean false Applies compact style to vs-select
emptyItemsText String No Data Available Empty text

Note You can also pass disable: true in array of objects to disable particular item.

// Example
<template>
  <vs-select :options="options"></vs-select>
</template>

<script>
  import { VsSelect } from 'vs-select';

  export default {
    data() {
      return {
        options: [
          { label: 'Iron Man', value: 'Tony' },
          { label: 'Thor', value: 'thor', disabled: true },
          { label: 'Captain America', value: 'Steve Roger' },
        ],
      };
    },
  };
</script>

🔥 Events

Name Description
v-model Emitted when the item is selected.
@change Emitted when the item is selected.
(arg1: value, arg2: object/value)

Note Colors/ radius can be modified for the select box using css variables. Default colors used:

<style>
  .vs-select,
  .vs-multiselect {
    --vs-select-bg: #ffffff;
    --vs-select-border: #d8dcde;
    --vs-select-border-hover: #5293c7;
    --vs-select-hover: #edf7ff;
    --vs-select-error: #cc3340;
    --vs-select-icon: #68737d;
    --vs-select-border-radius: 4px;
  }
</style>

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.0.76latest
1.4.181v2-latest

Version History

VersionDownloads (Last 7 Days)Published
3.0.76
3.0.60
3.0.50
3.0.30
3.0.20
3.0.10
3.0.00
1.4.181
1.4.150
1.4.140
1.4.1358
1.4.120
1.4.110
1.4.100
1.4.90
1.4.80
1.4.60
1.4.50
1.4.40
1.4.398
1.4.20
1.4.10
1.4.012
1.3.410
1.3.400
1.3.393
1.3.380
1.3.370
1.3.360
1.3.350
1.3.340
1.3.330
1.3.320
1.3.310
1.3.300
1.3.290
1.3.280
1.3.272
1.3.260
1.3.250
1.3.240
1.3.230
1.3.210
1.3.2021
1.3.190
1.3.180
1.3.170

Package Sidebar

Install

npm i @vuesimple/vs-select

Weekly Downloads

201

Version

3.0.7

License

MIT

Unpacked Size

119 kB

Total Files

11

Last publish

Collaborators

  • ashwinkshenoy