An inline, customizable and editable text component built in React.
npm install react-simple-editlabel allows the user to simply click and edit text inline. It consists of a element to display the unedited text and an element to allow editing.
npm install --save react-simple-editlabel
text
text
onFocusOut when escpe is clicked
javascript
import React from 'react';
import ReactDOM from 'react-dom';
import EditableLabel from 'react-simple-editlabel';
class App extends React.Component {
constructor(props){
super(props);
this._handleFocus = this._handleFocus.bind(this);
this._handleFocusOut = this._handleFocusOut.bind(this);
}
_handleFocus(text) {
console.log('Focused with text: ' + text);
}
_handleFocusOut(text) {
console.log('Left editor with text: ' + text);
}
render() {
return
labelClassName='myLabelClass'
inputClassName='myInputClass'
inputWidth='200px'
inputHeight='25px'
inputMaxLength='50'
labelFontWeight='bold'
inputFontWeight='bold'
onFocus={this._handleFocus}
onFocusOut={this._handleFocusOut}
/>
}
}
ReactDOM.render(
,
document.getElementById('container')
);
``