All Projects → moreta → Vue Search Select

moreta / Vue Search Select

Licence: mit
A Vue.js search select component

Projects that are alternatives of or similar to Vue Search Select

vue-single-select
single select dropdown with autocomplete
Stars: ✭ 43 (-85.52%)
Mutual labels:  select, vue-component
Vue Select
Everything you wish the HTML <select> element could do, wrapped up into a lightweight, extensible Vue component.
Stars: ✭ 4,115 (+1285.52%)
Mutual labels:  vue-component, select
vue-simple-upload-component
A simple upload component for Vue.js 2.x
Stars: ✭ 14 (-95.29%)
Mutual labels:  vue-component
React Native Calendar Select
A component to select period from calendar like Airbnb
Stars: ✭ 279 (-6.06%)
Mutual labels:  select
django-select2
This is a Django integration for Select2
Stars: ✭ 73 (-75.42%)
Mutual labels:  select
unist-util-select
utility to select unist nodes with CSS-like selectors
Stars: ✭ 41 (-86.2%)
Mutual labels:  select
Vue Float Menu
🎈Customizable floating menu for Vue
Stars: ✭ 252 (-15.15%)
Mutual labels:  vue-component
tom-select
Tom Select is the hybrid of a textbox and select box. Forked from selectize.js to provide a framework agnostic autocomplete widget with native-feeling keyboard navigation. Useful for tagging, contact lists, etc.
Stars: ✭ 520 (+75.08%)
Mutual labels:  select
Selectr
A lightweight, vanilla javascript select box replacement. No dependencies.
Stars: ✭ 293 (-1.35%)
Mutual labels:  select
vue-popover
Reusable popover component for Vue
Stars: ✭ 22 (-92.59%)
Mutual labels:  vue-component
Formvuelar
Vue form components with server-side validation in mind
Stars: ✭ 263 (-11.45%)
Mutual labels:  select
prosumer
A producer-consumer solution for Golang
Stars: ✭ 31 (-89.56%)
Mutual labels:  select
vui-vc-next
Vue 3 with Vite Playground - Mobile web UI components - (vue3+vite2).
Stars: ✭ 15 (-94.95%)
Mutual labels:  vue-component
Material Ui Superselectfield
multiselection autocomplete dropdown component for Material-UI
Stars: ✭ 260 (-12.46%)
Mutual labels:  select
vue-notification-bell
Vue.js notification bell component.
Stars: ✭ 64 (-78.45%)
Mutual labels:  vue-component
Vue Cute Timeline
A cute timeline component for Vue.js.
Stars: ✭ 289 (-2.69%)
Mutual labels:  vue-component
vue-feather
Feather component for Vue.js.
Stars: ✭ 108 (-63.64%)
Mutual labels:  vue-component
ev
Lightweight event-loop library based on multiplexing IO
Stars: ✭ 15 (-94.95%)
Mutual labels:  select
Vue A11y Calendar
Accessible, internationalized Vue calendar
Stars: ✭ 255 (-14.14%)
Mutual labels:  vue-component
Onedrawable
✏️ Use only one image to set a background with a click effect for the View
Stars: ✭ 298 (+0.34%)
Mutual labels:  select

vue-search-select

A Vue.js search select component with NO dependencies.

Version 2.x

  • Support Vue.js 2.x
  • Five Select Component
    • ModelSelect (from v2.3.8)
      • value set through v-model
      • value can be string, number, boolean and object
        • If you v-model type is string, onInput set by string. (Not option object)
    • ModelListSelect (from v2.3.8)
      • value set through v-model
      • Can pass custom list and customize display text to Component
      • Wrap ModelSelect component
    • MultiSelect
      • search select for multiple select
    • MultiListSelect
      • ListSelect for MultiSelect
    • BasicSelect
    • ListSelect
      • value set through @select event
      • Can pass custom list and customize display text to Component
      • Wrap BasicSelect component

Version 2.9.1

From v2.9.1 library css extracted standalone file.

There are three file.

  • VueSearchSelect.common.js
    • common js bundle for consuming via bundlers(webpack)
  • VueSearchSelect.umd.js
    • umd bundle for browser
  • VueSearchSelect.css
    • extracted css

From v2.9.1 vue-search-select no more need semantic-ui-css. (Demo page wrote without semantic-ui) But Need css import somewhere in your app.(for example main.js)

import 'vue-search-select/dist/VueSearchSelect.css'

And still semantic-ui-css compatible html and css classes used.

If you already use semantic-ui(or formantic-ui) VueSearchSelect.css import is unnecessary. If you want use vue-search-select without semantic-ui-css, import VueSearchSelect.css.

ModelSelect

  • ModelSelect component's v-model value can be string, number, boolean and object.
  • If you v-model type is string, onInput set by string. (Not option object)
  • This very useful when you want create form. (You don't need additional processing for form value)

Release Notes

https://github.com/moreta/vue-search-select/releases

Demo

https://vue-search-select.netlify.com

Usage

Install

npm

npm install --save vue-search-select

yarn

yarn add vue-search-select

Install alpha version

npm install --save [email protected]
# or
npm install --save [email protected]

Setup

Add this on main.js or somewhere your plugin file. (from v2.9.1)

import 'vue-search-select/dist/VueSearchSelect.css'

If you already use semantic-ui-css, css import not necessary.

Sample code

See All Samples : src/components/sample

ModelSelect Component Example

more ModelSelect sample code see this

<template>
        <!-- object value -->
        <model-select :options="options"
                                v-model="item"
                                placeholder="select item">
         </model-select>

         <!-- string value -->
         <model-select :options="options2"
                                 v-model="item2"
                                 placeholder="select item2">
         </model-select>
</template>

<script>
  import { ModelSelect } from 'vue-search-select'

  export default {
    data () {
      return {
        options: [
          { value: '1', text: 'aa' + ' - ' + '1' },
          { value: '2', text: 'ab' + ' - ' + '2' },
          { value: '3', text: 'bc' + ' - ' + '3' },
          { value: '4', text: 'cd' + ' - ' + '4' },
          { value: '5', text: 'de' + ' - ' + '5' }
        ],
        item: {
          value: '',
          text: ''
        },
        options2: [
          { value: '1', text: 'aa' + ' - ' + '1' },
          { value: '2', text: 'ab' + ' - ' + '2' },
          { value: '3', text: 'bc' + ' - ' + '3' },
          { value: '4', text: 'cd' + ' - ' + '4' },
          { value: '5', text: 'de' + ' - ' + '5' }
        ],
        item2: ''
      }
    },
    methods: {
      reset () {
        this.item = {}
      },
      selectFromParentComponent1 () {
        // select option from parent component
        this.item = this.options[0]
      },
      reset2 () {
        this.item2 = ''
      },
      selectFromParentComponent2 () {
        // select option from parent component
        this.item2 = this.options2[0].value
      }
    },
    components: {
      ModelSelect
    }
  }
</script>

ModelListSelect Component Example

more ModelListSelect sample code see this

<template>
  <model-list-select :list="options1"
                     v-model="objectItem"
                     option-value="code"
                     option-text="name"
                     placeholder="select item">
  </model-list-select>
  <model-list-select :list="options2"
                     v-model="stringItem"
                     option-value="code"
                     :custom-text="codeAndNameAndDesc"
                     placeholder="select item">
  </model-list-select>
</template>

<script>
  import { ModelListSelect } from 'vue-search-select'

  export default {
    data () {
      return {
        options1: [
          { code: '01', name: 'aa', desc: 'desc01' },
          { code: '02', name: 'ab', desc: 'desc02' },
          { code: '03', name: 'bc', desc: 'desc03' },
          { code: '04', name: 'cd', desc: 'desc04' },
          { code: '05', name: 'de', desc: 'desc05' },
          { code: '06', name: 'ef', desc: 'desc06' }
        ],
        objectItem: {},
        options2: [
          { code: '01', name: 'aa', desc: 'desc01' },
          { code: '02', name: 'ab', desc: 'desc02' },
          { code: '03', name: 'bc', desc: 'desc03' },
          { code: '04', name: 'cd', desc: 'desc04' },
          { code: '05', name: 'de', desc: 'desc05' },
          { code: '06', name: 'ef', desc: 'desc06' }
        ],
        stringItem: ''
      }
    },
    methods: {
      codeAndNameAndDesc (item) {
        return `${item.code} - ${item.name} - ${item.desc}`
      },
      reset1 () {
        this.objectItem = {}
      },
      selectFromParentComponent1 () {
        // select option from parent component
        this.objectItem = this.options[0]
      },
      reset2 () {
        this.stringItem = ''
      },
      selectFromParentComponent2 () {
        // select option from parent component
        this.stringItem = this.options[0].code
      }
    },
    components: {
      ModelListSelect
    }
  }
</script>

MultiSelect Component Example

<template>
        <multi-select :options="options"
                       :selected-options="items"
                       placeholder="select item"
                       @select="onSelect">
        </multi-select>
</template>

<script>
  import _ from 'lodash'
  import { MultiSelect } from 'vue-search-select'

  export default {
    data () {
      return {
        options: [
          { value: '1', text: 'aa' + ' - ' + '1' },
          { value: '2', text: 'ab' + ' - ' + '2' },
          { value: '3', text: 'bc' + ' - ' + '3' },
          { value: '4', text: 'cd' + ' - ' + '4' },
          { value: '5', text: 'de' + ' - ' + '5' }
        ],
        searchText: '', // If value is falsy, reset searchText & searchItem
        items: [],
        lastSelectItem: {}
      }
    },
    methods: {
      onSelect (items, lastSelectItem) {
        this.items = items
        this.lastSelectItem = lastSelectItem
      },
      // deselect option
      reset () {
        this.items = [] // reset
      },
      // select option from parent component
      selectFromParentComponent () {
        this.items = _.unionWith(this.items, [this.options[0]], _.isEqual)
      }
    },
    components: {
      MultiSelect
    }
  }
</script>

Props

Component Name Type Default Description
ModelSelect options Array option list
isError Boolean false error style
isDisabled Boolean false disable component
placeholder String ''
filterPredicate String new RegExp(inputText, 'i')
customAttr Function () => '' Add custom html attribute
name String input form name attribute
id String id attribute
ModelListSelect list Array option list
optionValue String value key
optionText String text key
customText Function custom text function
isError Boolean false error style
isDisabled Boolean false disable component
placeholder String ''
filterPredicate String new RegExp(inputText, 'i')
name String input form name attribute
id String id attribute
BasicSelect options Array option list
selectedOption Object { value: '', text: '' } default option
isError Boolean false error style
isDisabled Boolean false disable component
placeholder String ''
customAttr Function () => '' Add custom html attribute
filterPredicate String new RegExp(inputText, 'i')
name String input form name attribute
id String id attribute
ListSelect list Array option list
optionValue String value key
optionText String text key
customText Function custom text function
selectedItem Object default option(raw object)
isError Boolean false error style
isDisabled Boolean false disable component
placeholder String ''
filterPredicate String new RegExp(inputText, 'i')
name String input form name attribute
id String id attribute
MultiSelect options Array option list
selectedOptions Array default option list
isError Boolean false error style
isDisabled Boolean false disable component
placeholder String ''
filterPredicate String new RegExp(inputText, 'i')
customAttr Function () => '' Add custom html attribute
hideSelectedOptions Boolean false Hide Option list that item selected
name String input form name attribute
id String id attribute
MultiListSelect list Array option list
optionValue String value key
optionText String text key
customText Function custom text function
selectedItems Array default option(raw object)
isError String false error style
isDisabled Boolean false disable component
placeholder String ''
filterPredicate String new RegExp(inputText, 'i')
name String input form name attribute
id String id attribute

Run examples

npm install
npm run serve
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].