react-typeahead-component icon indicating copy to clipboard operation
react-typeahead-component copied to clipboard

Support for tags

Open mwilc0x opened this issue 10 years ago • 1 comments

It would be cool if you could do multiple queries for a given input, and have queries saved as tags in the input field.

Something similar to this: https://github.com/olahol/react-tagsinput

Have you thought about adding something like this?

mwilc0x avatar Sep 09 '15 17:09 mwilc0x

We actually did implement this, but instead as a higher-order component which used Typeahead. This was done to keep the reusability of Typeahead extremely high, e.g. there were cases where we didn't need tags/tokens. We didn't end up releasing it though. The basic skeleton went something like:

var TokenizedTypeahead = React.createClass({
    render: function() {
        return (
            <div>
                {this.renderTokens()}
                <Typeahead
                    onKeyDown={function(e) {
                        if (e.key === 'Tab') {
                            this.createToken()
                        }
                    }}
                />
             </div>
         );
    }
});

ezequiel avatar Sep 17 '15 04:09 ezequiel