Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue3-simple-typeahead

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue3-simple-typeahead

Simple Vue3 typeahead component that show a suggested list of elements while the user types in.

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

vue3-simple-typeahead

A Vue3 component for a simple typeahead component. It will show a list of suggested items based on the user input.

Demo

//Pending

Installation

NPM

npm install vue3-simple-typeahead

Browser

You can also use the browser bundle in a script tag.

<script src="https://unpkg.com/@frikinside/vue3-simple-typeahead"></script>

Usage

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 Vue from 'vue'
import SimpleTypeahead from 'vue3-simple-typeahead'
import 'vue3-simple-typeahead/dist/vue3-simple-typeahead.css'

Vue.use(SimpleTypeahead)

You can also import vue3-simple-typeahead locally in your component if you prefer.

import SimpleTypeahead from 'vue3-simple-typeahead'

export default {
  name: 'my-component',
  ...
  components: {
    SimpleTypeahead
  }
  ...
}

Then, use the component in your app.

<simple-typeahead 
    id="typeahead_id" 
    placeholder="Start writing..." 
    :items="['One','Two','Three',...]" 
    @selectItem="selectItemEventHandler" 
    @onInput="onInputEventHandler"
    @onFocus="onInputEventHandler"
    @onBlur="onInputEventHandler">
</simple-typeahead>

Props

PropTypeDefaultDescription
idStringRandom id generationThe id for the input control. Can be useful to link with a label for=""
placeholderString''Placeholder text for the input
itemsArray (Required)List of strings with the elements for suggestions

Events

EventSignatureDescription
selectItemfunction (item: String): voidEmitted when the user selects an item from the suggestion list
onInputfunction (input: String): voidEmitted when the user types anything
onFocusfunction (input: String): voidEmitted when the input control get the focus
onBlurfunction (input: String): voidEmitted when the input control lost the focus [When the user select an item, the focus is lost too]

FAQs

Package last updated on 09 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc