1.1.1 • Published 5 years ago

@kugatsu/vueautocompleteinput v1.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Autocomplete Vue JS 🚀

The Autocomplete vue component allow you to create select input with autocomplete drop down. You can select with arraow / enter / click or just fill the field.

Demo here => Code Sandbox

demo

How to use it

Install with npm.

npm i @kugatsu/vueautocompleteinput --save

Import with ES6

import VueAutocomplete from "@kugatsu/vueautocompleteinput";

components: {
   VueAutocomplete
},
data: function() {
    return {
        articles: [{id: 1, label: "first items"}],
        article: undefined // or {id: 1, label: "first items"} to initialise
    };
},
<vue-autocomplete :items="articles" v-model="article" property-to-display="label"></vue-autocomplete>

Parameters

NameTypeDefault value
itemsStringrequired
v-modelObjectrequired
placeholderStringSearch
emptyResultsNo resultNo results
propertyToDisplayStringlabel
disableBooleanfalse
closeButonBooleantrue
classComponentString""
classInputString"autocomplete-input-custom"
classWrapperString"autocomplete-list-wrapper-custom"
classListString"autocomplete-list-custom"
classItemString"autocomplete-list-item-custom"
classItemActiveString"autocomplete-item-active-custom"

Event throw

EventWhen
selectedvalue is selected
clearinput is empty
noResultfilter return no value

Slot

  1. Item row You can huse slot to fully customize item row.

Sample 💩:

<template v-slot:listItem="slotProps">
    <h4 style="margin: 0;">{{slotProps.item.title}}</h4>
    <br>
    {{slotProps.item.body}}
</template>
  1. Close btn

Use closeButton scope to personalize your clear button or use autocomplete-clear-btn to surcharge style.

<template v-slot:closeButton>X</template>

Customise

The initial style is very basic to let you the power to custumize and integrate easily the component with your website design.

You have the possibility of surchage class or redifign them.

All class used
Classsurchage
autocompleteno
autocomplete-inputno
utocomplete-input-customclassInput
autocomplete-list-wrapperno
autocomplete-list-wrapper-customclassWrapper
autocomplete-listno
autocomplete-list-customclassList
autocomplete-list-itemno
autocomplete-list-item-customclassItem
autocomplete-item-active-customclassItemActive
search-result-item-disabledno
autocomplete-clear-btnno