0.0.5 • Published 4 years ago

tags-input-react v0.0.5

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

tags-input-react

Tags Input Component

How to Install

Make sure you have Node.js and NPM installed.

npm install tags-input-react

Demo

Check demo online here.

How to Use

import React, { Component } from 'react'
import TagsInput from 'tags-input-react'

class TagsInputDemo extends Component {
  constructor() {
    super()
    this.state = {
      tags: []
    }
    this.handleOnChange = this.handleOnChange.bind(this)
  }

  handleOnChange (tags, value) {
    this.setState({
      tags
    })
  }

  render() {
    return (
      <TagsInput
        placeholder='Type here...'
        onChange={this.handleOnChange}
      />
    )
  }
}

Available PropTypes

Prop NameTypeDefault ValueDescription
tagsarray[]Array of tags for Pre-populate in Input
preventDuplicatesBooleantruePreventing duplicates in tags
placeholderstring'Type here'Placeholder in input
onChangeFunctionnullCallback function to get the tags created by user