React implementation of content editable element
npm install picr-react-content-editablenpm install picr-react-content-editable``javascript
import React, { Component } from 'react';
import ContentEditable from 'picr-react-content-editable';
class App extends Component {
constructor(props) {
super(props);
this.state = {
value: ''
};
}
onInputChange = (e) => {
this.setState({ value: e.target.value });
}
render() {
return (
value={this.state.value}
/>
);
}
}
export default App;
`Props
| Prop | Description | Type | Default |
|:--------------|:-----------------------------|:-------|:--------|
|className | component wrapper class name | string | '' |
|fieldClassName | input/textarea class name | string | '' |
|customElement | custom element that renders instead of default input/textarea | React component, DOM | null
|type | type of field element | string ('input\|textarea') | 'input'
|onChange | input/textarea onchange callback | function | RequiredRequired`
| value | input/textarea value | string |