/mui-editable-label

A easy editable label for react using material-ui

Primary LanguageJavaScript

mui-editable-label

Travis npm package Coveralls

mui-editable-label is a easy and small component Label that you can edit just by clicking.

how to install

npm i mui-editable-label

how to use:

function Demo() {
  const [text, setText] = useState("Click here to edit.");

  return (
    <div>
      <h1>mui-editable-label Demo</h1>
      <MuiEditableLabel
        initialValue={text}
        onFocus={value => console.log("on focus: ", value)}
        onBlur={value => {
          console.log('on blur: ', value);
          setText(value);
        }}
      />
    </div>
  );
}

see a example here

component api

Events Description return
onFocus trigged when user clicks a string input value
onBlur trigged when user get out focus from component or press enter key a string input value
Props Description
initialValue initial string value