A Vue3 component for a simple typeahead component. It will show a list of suggested items based on the user input.
The component includes its own input and when the user types on it the suggested options appear.
Installation
npm install vue3-simple-typeahead
Add installed component to your app
Import the vue3-simple-typeahead component and register it globally in your Vue app. Import the CSS as well if you wish to use the default styling.
import { createApp } from 'vue';
import App from './App.vue';
import SimpleTypeahead from 'vue3-simple-typeahead';
import 'vue3-simple-typeahead/dist/vue3-simple-typeahead.css'; //Optional default CSS
let app = createApp(App);
app.use(SimpleTypeahead);
app.mount('#app');
Usage
<vue3-simple-typeahead id="typeahead_id" placeholder="Start writing..." :items="['One','Two','Three',...]" :minInputLength="1" :itemProjection="itemProjectionFunction" @selectItem="selectItemEventHandler" @onInput="onInputEventHandler" @onFocus="onFocusEventHandler" @onBlur="onBlurEventHandler" > </vue3-simple-typeahead>
For more details go through the given URL: A simple Vue3 typeahead component that show a suggested list of elements while the user types in