1.2.4 • Published 9 months ago

vue-typeahead3 v1.2.4

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

⌨️ vue-typeahead3 Vue version NPM version NPM downloads size Pipeline

Table of Contents

About

vue-typeahead3 is a super lightweight (only 3.65Kb zipped) typeahead / autocompletion component for Vue.js 3. It's written in TypeScript using Vue.js 3 Composition API.

Installation

// NPM
$ npm install vue-typeahead3

// Yarn
$ yarn add vue-typeahead3

After the package got installed things are straight forward. Simply import and register the component:

// src/main.js
import { createApp } from 'vue'
...
import typeahead from 'vue-typeahead3'
import "vue-typeahead3/dist/vue-typeahead.css";

const app = createApp(App)
...
app.use(typeahead) // register typeahead component
...
app.mount('#app')

Usage

Once the plugin is registered you can straight up use it in your app.

Basic example:

<template>
    <typeahead :data="suggestions" v-model="food" />
    <small>You selected: {{ food }}</small>
</template>

<script>
...
data() {
  return {
    suggestions: [
    {
      value: "Banana",
      category: "Fruit",
    },
    {
      value: "Shallots",
      category: "Vegetable",
    },
    {
      value: "Ananas",
      category: "Fruit",
    },
    {
      value: "Avocado",
      category: "Fruit",
    },
    {
      value: "Garlic",
      category: "Vegetable",
    },
  ],
  food: "",
 }
}
...
</script

Configuration

propertytyperequireddefaultdescription
v-model:heavy_check_mark:Specifies where the selected item is stored in the parent component.
suggestionsRecord<string, string>[] (Array of Objects):heavy_check_mark:Suggestions to filter
placeholderstring:x:Type to search...Placeholder for search input
searchKeystring:x:valueSpecifies the key to use for the actual search. Must either equal categoryKey or valueKey
categoryKeystring:x:categorySpecifies the key to use for the categories.
valueKeystring:x:valueSpecifies the key to use for the value.
maxResultsnumber:x:5Specifies the max amount of suggestions displayed within the dropdown.
1.2.4

9 months ago

1.2.3

10 months ago

1.2.2

10 months ago

1.2.0

12 months ago

1.2.1

12 months ago

1.2.0-rc3

12 months ago

1.2.0-rc2

12 months ago

1.2.0-rc1

12 months ago

1.2.0-rc0

12 months ago

1.2.1-rc1

12 months ago

1.2.1-rc0

12 months ago

1.2.1-rc3

12 months ago

1.2.1-rc2

12 months ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1-rc2

2 years ago

1.1.1-rc1

2 years ago

1.1.1-rc0

2 years ago

1.0.0

3 years ago

0.3.0

3 years ago

0.2.9

3 years ago

0.2.8

3 years ago

0.2.7

3 years ago

0.2.6

3 years ago

0.2.5

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago