npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

typeahead-autocomplete

v1.0.9

Published

A VueJS plugin for typeahead autocomplete

Downloads

119

Readme

typeahead-autocomplete

Description

This package is available for VueJS 2x

View The Examples

image image

Installation

From NPM:

> npm i typeahead-autocomplete

Browser

<script
  type="text/javascript"
  src="node_modules/vuejs/dist/vue.min.js"
></script>
<script
  type="text/javascript"
  src="node_modules/typeahead-autocomplete/dist/typeahead-autocomplete.min.js"
></script>
<script type="text/javascript">
  Vue.use(TypeaheadAutocomplete);
</script>

Usage

Import and register the component

import TypeaheadAutocomplete from "typeahead-autocomplete";

// Global registration
Vue.use(TypeaheadAutocomplete);

// OR

// Local registration
export default {
  components: {
    TypeaheadAutocomplete,
  },
};

Basic Usage

<typeahead-autocomplete
  v-model="selectedValue"
  :items="[
    { 
      text: 'ABC', 
      value: 'abc' 
    }, 
    { 
      text: 'DEF', 
      value: 'def' 
    }, 
    { 
      text: 'GHI', 
      value: 'ghi' 
    }
  ]"
/>

Attributes

| Name | Type | Default | Description | | -------------- | ------------------ | ------- | ------------------------------------------------------------------------------------------------- | | items | Array | [] | Array of data. | | initialText | String | text | The displayed text at first. | | initialValue | String, Number | value | The selected value at first. | | bindingText | String | text | Path to the property used to display the text. | | bindingValue | String | value | Path to the property used to return the value. | | prependText | String | | Text used to add at the beginning of the item. | | appendText | String | | Text used to add at the end of the item. | | disableSearch | Boolean | false | Turn off the search function on the input field. | | disableInput | Boolean | false | Disable input. | | placeholder | String | | Placeholder for input field. | | inputClass | String | | Custom classes for input field. | | readOnly | Boolean | false | Set read-only for input field. | | showNoData | Boolean | true | Option to show text or not when no data is found. | | remoteMode | Boolean | false | Switch to load data through API. | | remoteUrl | String | | Data request URL (Only works when remoteMode is enabled. | | requestTimeout | Number | 10000 | Maximum time for API to request data (milliseconds) (Only works when remoteMode is enabled. |

Events

| Name | Description | | -------- | ------------------------------------------------------------------------------------------------------------------- | | change | Triggered when an autocomplete item is selected. The entry in the input data array that was selected is returned. | | input | Triggered when typing on search box. The typed data is returned. | | hit | The component can be used with v-model. The bindingValue of the entry in the input data will be returned | | fetch | Return all data from API after successfully fetched. |

Slots

prepend and append slots available for adding buttons or other markup. nodata available for customizing the text when no data is found.

Contributing

PR's are welcome!