0.5.1 • Published 1 year ago

@st-kovalenko/vue-bootstrap-select v0.5.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Vue.js dropdown with search box

A Vue.js 3 version of bootstrap select.

About

A component that allows you to search select options.

This project is a fork from the original Sandalf/vue-bootstrap-select project which is no longer maintained.

Requirements

  • Vue.js 3
  • Bootstrap CSS

Install

npm install @st-kovalenko/vue-bootstrap-select --save

Usage

import VueBootstrapSelect from '@st-kovalenko/vue-bootstrap-select'
import '@st-kovalenko/vue-bootstrap-select/dist/style.css'

export default {
  name: 'app',
  components: {
    VueBootstrapSelect
  },
  data() {
    return {
      selectedValue: null
    };
  }
}
<template>
  <div id="app">
    <VueBootstrapSelect :options="[{value: 1, text: 'Item 1'}, {value: 2, text: 'Item 2'}]" v-model="selectedValue" />
  </div>
</template>

Passing options

The options property accepts arrays of strings.

<VueBootstrapSelect :options="['Item 1', 'Item 2']" />

And arrays of objects

<VueBootstrapSelect :options="[{value: 1, text: 'Item 1'}, {value: 2, text: 'Item 2'}]" />

Props

parameterdescriptiontypedefaultacceptable value
disableddisables selectBooleanfalse
disabledPropallows to disable specific options. If an option has this prop set to a truthy value it will disable the option.Stringdisabled
labelNotFoundtext displayed when no option is found in the search resultsStringNo results matched
labelSearchPlaceholderplaceholder text for search inputStringSearch
optionslist of optionsArray[]
searchabledisplay search inputBooleanfalse
showDefaultOptionsets the select title is set as an optionBooleanfalse
textPropthe option's prop that is displayed as the option's textStringtext
valuePropthe option's prop that is used to find the selected valueStringvalue

Testing

Tested with the following configuration:

  • Node.js:
  • NPM:
  • Vue.js:
npm run serve