Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including react-copy-content with all npm packages installed. Try it out:

require("prop-types/package.json"); // prop-types is a peer dependency. require("react/package.json"); // react is a peer dependency. require("react-dom/package.json"); // react-dom is a peer dependency. var reactCopyContent = require("react-copy-content")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

react-copy-content v1.0.2

Enable Click to Copy in your React Apps


A Fully Customizable Click-To-Copy Component for React

NPM JavaScript Style Guide



Checkout the Live Demo


npm install --save react-copy-content


import ClickToCopy from 'react-copy-content'

<ClickToCopy contentToCopy="This will be copied to your clipboard." />


contentToCopy: String

This is the text that will be copied. It is a required prop.

onCopy: function

  contentToCopy="This will be copied to the clipboard"
  onCopy={() => console.log("copy")}

This is the callback function triggered after the content is copied to the clipboard

render: function

  contentToCopy="This will be copied to the clipboard"
  render={props => (
    <a href="#copy" onClick={props.copy}>

To render a custom component in place of the button, use the render prop. Inside your custom component, use props.copy to trigger the copy action.


MIT © akshayymahajan


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free