react-chips-devitjobs
Version:
A flexible and easy to use Chips component for React
44 lines (37 loc) • 743 B
JavaScript
import React, { Component } from 'react';
import Chips, { Chip } from '../../src'
const data = [
'JavaScript',
'Ruby',
'Python',
'Java',
'Swift',
'C++',
'C',
'Objective C',
'Go'
];
class BasicExample extends Component {
constructor(props) {
super(props);
this.state = {
value: []
}
}
onChange = value => {
this.setState({ value });
}
render() {
return (
<Chips
value={this.state.value}
onChange={this.onChange}
createChipKeys={['a']}
placeholder="Type a Programming Language"
suggestions={data}
shouldRenderSuggestions={value => value.length >= 0}
fromSuggestionsOnly={false} />
);
}
}
export default BasicExample;