2.0.7 • Published 4 years ago

@feizheng/react-ant-editable-tag-group v2.0.7

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

react-ant-editable-tag-group

Editable tag group for ant.

installation

npm install -S @feizheng/react-ant-editable-tag-group

update

npm update @feizheng/react-ant-editable-tag-group

properties

NameTypeDefaultDescription
classNamestring-The extended className for component.
valuearray[]Default value.
onChangefuncnoopThe change handler.
minnumber0The minimum tag number.
maxnumber20The maximum tags number.
quickboolfalseIf use keymap enter key to quick add tag.

usage

  1. import css

    @import "~@feizheng/react-ant-editable-tag-group/dist/style.scss";
    
    // customize your styles:
    $react-ant-editable-tag-group-options: ()
  2. import js

    import ReactAntEditableTagGroup from '@feizheng/react-ant-editable-tag-group';
    import ReactDOM from 'react-dom';
    import React from 'react';
    import './assets/style.scss';
    
    class App extends React.Component {
      state = {
        items: ['tag1', 'tag2', 'tag3']
      };
    
      onRandom = (inEvent) => {
        const random = Math.floor(Math.random() * 10);
        const items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
        const _items = items.slice(0, random);
        console.log('on random:', _items);
        this.setState({ items: _items });
      };
    
      render() {
        const { items } = this.state;
        return (
          <div className="app-container">
            <p>
              <button onClick={this.onRandom}>Set Random Items</button>
            </p>
            <ReactAntEditableTagGroup
              quick
              value={items}
              onChange={(e) => {
                this.setState({ items: e.target.value });
              }}
            />
          </div>
        );
      }
    }
    
    ReactDOM.render(<App />, document.getElementById('app'));

documentation

2.0.3

4 years ago

2.0.2

4 years ago

2.0.5

4 years ago

2.0.7

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago