1.0.0 • Published 4 years ago
@jswork/react-ant-editable-tag v1.0.0
react-ant-editable-tag
Editable tag for ant.
installation
npm install -S antd@3
npm install -S @jswork/react-ant-editable-tag
properties
Name | Type | Required | Default | Description |
---|---|---|---|---|
className | string | false | - | The extended className for component. |
onClose | func | false | noop | When click close icon. |
value | union | false | - | The tag value. |
onChange | func | false | noop | When value changed. |
usage
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: ()
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.
1.0.0
4 years ago