1.0.0 • Published 4 years ago

@jswork/react-ant-editable-tag v1.0.0

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

react-ant-editable-tag

Editable tag for ant.

version license size download

installation

npm install -S antd@3
npm install -S @jswork/react-ant-editable-tag

properties

NameTypeRequiredDefaultDescription
classNamestringfalse-The extended className for component.
onClosefuncfalsenoopWhen click close icon.
valueunionfalse-The tag value.
onChangefuncfalsenoopWhen value changed.

usage

  1. import css

    @import "~@jswork/react-ant-editable-tag/dist/style.css";
    
    // or use sass
    @import "~@jswork/react-ant-editable-tag/dist/style.scss";
    
    // customize your styles:
    $react-ant-editable-tag-options: ()
  2. import js

    import ReactDemokit from '@jswork/react-demokit';
    import React from 'react';
    import ReactDOM from 'react-dom';
    import ReactAntEditableTag from '@jswork/react-ant-editable-tag';
    import './assets/style.scss';
    
    class App extends React.Component {
      state = { value: 'tagvalue' };
    
      setRandomValue = () => {
        this.setState({
          value: (Math.random() + 'value').slice(0, 5)
        });
      };
    
      render() {
        const { value } = this.state;
        return (
          <ReactDemokit
            className="p-3 app-container"
            url="https://github.com/afeiship/react-ant-editable-tag">
            <button className="button is-primary is-fullwidth mb-2" onClick={this.setRandomValue}>
              SetRandomValue
            </button>
            <ReactAntEditableTag
              value={value}
              onChange={(e) => {
                this.setState({ value: e.target.value });
                console.log(e.target.value);
              }}
            />
          </ReactDemokit>
        );
      }
    }
    
    ReactDOM.render(<App />, document.getElementById('app'));

documentation

license

Code released under the MIT license.