Editable tag for ant.
Editable tag for ant.
@jswork/react-ant-editable-tag"">
@jswork/react-ant-editable-tag"">
npm install -S antd@3
npm install -S @jswork/react-ant-editable-tag
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. |
import css
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 ></App>, document.getElementById('app'));
Code released under the MIT license.