Using the Vue Fuse component to leverage Fuse.js, a lightweight search library


With components searching your data can be fairly easy. A lightweight Vue plugin, Vue Fuse is now available for fuzzy search using the existing library, Fuse.js. Take a look at the demo and proceed to see an implementation to a Vue.js project.

Vue Fuse 1.2 update for the search plugin is out now, adds $search instance method for quick and awesome searching anywhere in your app!



Install it in your project via yarn

yarn add vue-fuse

In your main.js file import the plugin

import VueFuse from 'vue-fuse'


Then in your templates, you can use the component


First, the keys property must be present in your data along with the list.

keys is a list of properties that will be searched. list is the array of items that Fuse will search.

Most of the props line up with Fuse.js options with the defaults set to match the default Fuse.js behavior.

Include these in your data function

export default {
  data () {
    return {
      bikes: [
          brand: "Schwinn",
          model: {
            name: "Classic",
            id: "1345"
          brand: "Red Line",
          model: {
            name: "Flight",
            id: "5430"
      keys: ["brand", "", ""]

Here we are using the data from the example given in the plugin's repo.

defaultAll, if true, then the results will include ALL items in the list when the search is null. If false, results will include no items when the search is null. The eventName is used here to give a name to the event emitted when the search results are updated. This is useful when you actually want to do something with the results.

After we give the event a name, here fuseResultsUpdated, we can run a function when its emitted



methods: {
    results (results) {
        this.result = results


We pass the results to an empty array, and then we can use a list to display them in real time

<ul v-for="item in result" class="list-group">
<!-- list items from the result array -->
    <li class="list-group-item">Brand: {{item.brand}}</li>
    <li class="list-group-item">Id: {{}}</li>
    <li class="list-group-item">Model: {{}}</li>

And there it is, Vue Fuse, utilizing the Fuse.js library

The vue fuse component leverages Fuse.js. For complete documentation, check out

Created by @shayneosullivan.