Skip to content

Latest commit

 

History

History
56 lines (36 loc) · 893 Bytes

README.md

File metadata and controls

56 lines (36 loc) · 893 Bytes

autocomplete

dropdown autocomplete for input elements

Installing

$ component-install stagas/autocomplete

API

Inherits all methods from Dropdown and Menu.

Autocomplete(input, [items], [asyncFn])

Attach autocomplete to an input element.

Autocomplete.maxItems(n:Number)

Set the maximum number of visible items.

Usage

With a default set:

var autocomplete = require('autocomplete')
var ac = autocomplete(input, ["One", "Two", "Three"])

Using async results:

autocomplete(input, function (str, callback) {
  someAsyncRequest(str, function (results) {
    callback(results)
  })
})

Both:

autocomplete(input, ["One", "Two", "Three"], function (str, callback) {
  someAsyncRequest(str, function (results) {
    callback(results)
  })
})

License

MIT