0.1.4 • Published 3 years ago

@ammadbaig10/vue-advance-search-box v0.1.4

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

Vue Advance Search Box

Advanced and fully customizable search box. ###Features: 1. Placeholder replaceable. 2. Icons replaceable. 3. Fully access over styling. 4. Bold text on items according to the search value. 5. Access Over on-typing Event. * on-typing event call when user stop typing on search box (Will avoid sending lot of requests to server). 6. Access over enter-press press event.

Installation

npm install vue-advance-search-box

Demo Example

demo.gif

Properties

proptypeDefaultDescription
searchResultsArraynullArray with items that was found after search.
isSearchingBooleanfalseFor showing "Load Icon" when finding items in progress.
disabledBooleanfalseFor disabling search box. Will not allow to write anything and feels like disabled.
onSelectHideListBooleanfalseFor Hiding searched items when user select any item from list.
placeholderStringWhat are you looking for ?Placeholder on search box.
searchNotFoundStringNot Found.When items not found after search.
addClassStringnullAdd extra class for style or any other purpose if needed.
iconSearchStringemptyFor Showing search icon on search box.
iconCancelStringemptyFor Showing cancel icon on search box for removing current search value. It will be btn with icon.
iconLoaderStringemptyFor Showing loader icon on search box when searching items in progress.
enter-pressfunction--Call your function when user press enter on search box.
on-typingfunction--Call your function while user typing on search box.
option-selectfunction--Call your function with parameter when user select any item from list. It will give selected "value and text".

Example Code Basic

<template>
  <SearchBar
      @enter-press="onEnter"
      @on-typing="onTyping"
      v-model="searchText"
      :is-searching="searching"
      :search-results="searchedItems"
      @option-select="selected"
      icon-search="fa fa-search"
      icon-cancel="fa fa-times"
      icon-loader="fas fa-circle-notch fa-spin"
  />
</template>

NOTE: It's not mandatory to send icons code only for FontAwesome. You can pass any other library code that you are using in your project.

### Example Code with all available features:
```js
<SearchBar
        placeholder="Find anything you want .."
        :search-results="searchedItems"
        v-model="searchText"
        @enter-press="onEnter"
        @on-typing="onTyping"
        @option-select="selected"
        :on-select-hide-list=true
        :disabled=false
        add-class="extra-class"
        :is-searching="searching"
        :search-not-found="'Not Found: '+searchText"
        icon-search="fa fa-search"
        icon-cancel="fa fa-times"
        icon-loader="fas fa-circle-notch fa-spin"
>
</SearchBar>

NOTE: You can put your own style on each and everything by passing your own class inside add-class