olahol / react-tagsinput

Highly customizable React component for inputing tags.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Assign different colors to tags

renanlalier opened this issue · comments

I would like to know how I can assign different colors to the tags. My wish is that one tag be yellow and one green sequentially.

I tried the solution below, but with each tag inserted the colors of all are changed

if(this.state.buyTags.length % 2 == 0){
return {className:'react-tagsinput-tag tag-yellow'}
}else{
return {className:'react-tagsinput-tag tag-green'}
}

Expected:
yellow, green, yellow, green, yellow ....

commented

Use the renderTag prop.