6

How can I disable Paste (Ctrl+V) and Copy (Ctrl+C) option in one of my TextFields of MaterialUI?

Iḿ using ReactJs

  • this stackoverflow might have your answer. https://stackoverflow.com/questions/12805803/disable-copy-paste-in-html-input-fields or https://stackoverflow.com/questions/46790050/disable-paste-on-react-native-textinput?rq=1 – horrible Jul 21 '20 at 17:59

1 Answers1

12

onCopy onCut onPaste are clipboard events. The below code is the sample.

The reference in react docs is below.

https://reactjs.org/docs/events.html#clipboard-events

 const handleChange = (e) => {
    e.preventDefault();
  };
    <TextField
      value={val}
      onCut={handleChange}
      onCopy={handleChange}
      onPaste={handleChange}
     />
Velu S Gautam
  • 822
  • 9
  • 18