1.0.0 • Published 3 years ago

@shapla/vue-select v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Shapla Select Field

A simple customized select field.

Table of contents

Installation

npm install --save @shapla/vue-select

Usage

Styles

with Sass:

import '@shapla/vue-select/src/index.scss';

with CSS:

import '@shapla/vue-select/dist/style.css';

Javascript Instantiation

import ShaplaSelect from '@shapla/vue-select';

export default {
  name: 'Hello',

  components: {
    ShaplaSelect
  },

  data(){
    return {
      options:['Sayful Islam', 3, true, {label: 'Bangladesh', value: 'BD'}],
    }
  },
}
<shapla-select
    v-model="option"
    :options="options"
    label="Choose a option"
    help-text="Help text goes here"
/>

Props

PropertyTypeRequiredDefaultDescription
optionsArrayyes | Array of value for select options.
labelStringyes | Input field label
modelValueStringno | Field value
labelKeyStringnolabelIf options contain object, then which key should show as label
valueKeyStringnovalueIf options contain object, then which key should show as value
clearableBooleannotrueIf set true, clear icon will be shown when there is a value
autocompleteStringno | Field autocomplete attribute
nameStringno | Field name attribute
idStringno | Field id attribute
helpTextStringno | Field help text
validationTextStringno | Field validation text
hasErrorBooleannofalseIf set true, field will show validationText
hasSuccessBooleannofalseIf set true, field will show success status
disabledBooleannofalseIf set true, field will be read only
requiredBooleannofalseIf set true, field must be filled
searchableBooleannofalseIf set true, a search input will be available to filter
closeOnSelectBooleannotrueIf set true, on selecting value dropdown will be closed
clearSearchOnSelectBooleannotrueIf set true, search value will be cleared on select
multipleBooleannofalseIf set true, multiple value can be selected
noOptionsTextStringnoSorry, no matching options.Text for no options text
singularSelectedTextStringnoitem selected.Placeholder text for singular selected options text
pluralSelectedTextStringnoitems selected.Placeholder text for plural selected options text

Listeners

The select component fires the following events:

update:modelValue: When you choose a value

<!-- template -->
<select-field @update:modelValue="handleChangeEvent"/>


<!-- method -->
methods: {
  handleChangeEvent(value){
    // Handle input event
  }
}