🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

vue-bulma-typeahead

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-bulma-typeahead

A Vue.js 2 typeahead component for the Bulma CSS framework

0.0.7
latest
Version published
Maintainers
1
Created

Vue Bulma Typeahead

npm version

A simple Vue.js 2 Bulma CSS-styled component with a typeahead dropdown

View the demo.

Installation

Install via NPM:

npm install vue-bulma-typeahead --save

Usage

Props

NameTypeRequiredDefaultDescription
sourceArrayTrue[]A data source. Must contain strings.
onSelectFunctionTrueN/ASuggestion selected event callback. Parameters: value, name
onChangeFunctionTrueN/ATypeahead input value changed event callback. Parameters: value, name
limitNumberFalse5Max number of suggestions to show in dropdown.
nameStringFalseN/AName of the typeahead.
asyncBooleanFalseTrueWhether to debounce the suggestions or not.
placeholderStringFalse""Placeholder value for input field

Example

Use like below. See the example code in the demo.

<template>

  <div class="container">
    <label class="label">U.S. State</label>
    <p class="control has-icons-left">

      <typeahead :source="source" :onSelect="onSelect" :onChange="onChange" :limit="5"></typeahead>

      <span class="icon is-small is-left">
        <i class="fa fa-magic"></i>
      </span>
    </p>
  </div>

</template>

<script>
import Typeahead from 'vue-bulma-typeahead'

export default {
  name: 'demo',
  components: { Typeahead },
  data () {
    return {
      source: ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California',
      'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii',
      'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana',
      'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi',
      'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico',
      'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Oregon',
      'Pennsylvania', 'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee',
      'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West Virginia',
      'Wisconsin', 'Wyoming'],
      value: ''
    }
  },
  methods: {
    onSelect (value) {
      this.value = value
    },
    onChange (value) {
      this.value = value
    }
  }
}
</script>

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

For detailed explanation on how things work, consult the docs for vue-loader.

FAQs

Package last updated on 16 Nov 2017

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