Skip to content

Latest commit

 

History

History
52 lines (43 loc) · 1.96 KB

README.md

File metadata and controls

52 lines (43 loc) · 1.96 KB

Manhattan Typeahead

Type-a-head and tokens for form fields.

npm version Build Status Coverage Status dependencies status

Installation

npm install manhattan-typeahead --save-dev

Usage

<label>
    Language
    <input
        name="languages_input"
        data-mh-typeahead
        data-mh-typeahead--coerce="valueOnly"
        data-mh-typeahead--list="C,C++,CoffeeScript,JavaScript,Lua,Moonscript,Perl,Python,Wren"
        >
    <input type="hidden" name="languages">
</label>

<label>
    Tags
    <input
        name="tags_input"
        value=""
        data-mh-tokenizer
        data-mh-tokenizer--hidden-selector="[name=tags]"
        data-mh-tokenizer--sortable
        >
    <input type="hidden" name="tags">
</label>
import * as $ from 'manhattan-essentials'
import {tokenizer, typeahead} from 'manhattan-typeahead'

const myTypeahead = new typeahead.Typeahead($.one('[data-mh-typeahead]'))
myTypeahead.init()

const myTokenizer = new tokenizer.Tokenizer($.one('[data-mh-tokenizer]'))
myTokenizer.init([{'label': 'Some tag', 'value': 'Some value'}])