Below are a few implementations of the component, for more options and events please see the README file documentation
View coverage report here
state = { tags: [] } onTagAdded(tag) { this.setState({ tags: [...this.state.tags, tag] }); } onTagRemoved(tag, index) { this.setState({ tags: this.state.tags.filter((tag, i) => i !== index) }); } <Tags tags={this.state.tags} onAdded={this.onTagAdded.bind(this)} onRemoved={this.onTagRemoved.bind(this)} />
Pass in some default tags to the component.
state = { tags: ['foo', 'bar'] } <Tags tags={this.state.tags} />
Tags cannot be deleted or added.
<Tags readOnly={true} />
Tags are able to have a custom delete element or a string.
<Tags removeTagIcon="delete" />
//-- Custom element const removeIcon = <span>--</span>; <Tags removeTagIcon={removeIcon} />
The same tag can never be added twice.
<Tags uniqueTags={true} />