{"name":"react-copy-to-clipboard","version":"5.1.1","description":"Copy-to-clipboard React component","main":"lib/index.js","config":{"component":"CopyToClipboard"},"scripts":{"build":"yarn lib && yarn dist","start":"NODE_ENV=development webpack-cli serve --config ./webpack/dev.config.js","predist":"rm -rf ./build","dist":"NODE_ENV=production webpack-cli --config ./webpack/dist.config.js && NODE_ENV=production webpack-cli --config ./webpack/min.config.js","preghPages":"yarn pub","ghPages":"gh-pages --dist ./pub --repo git@github.com:nkbt/react-copy-to-clipboard.git --user nik@butenko.me --branch gh-pages --message 'Publish examples'","prelib":"rm -rf ./lib","lib":"NODE_ENV=production babel src --out-dir lib","lint":"biome check .","lint:fix":"biome check --unsafe --write .","prepub":"rm -rf ./pub","pub":"NODE_ENV=production webpack-cli --config ./webpack/pub.config.js","test":"node test/Component-test.js","prepublishOnly":"yarn build","postversion":"git push --follow-tags","deps":"depcheck","check:deps":"[ ! $(depcheck | grep --invert-match 'No depcheck issue') ]"},"repository":{"type":"git","url":"git+https://github.com/nkbt/react-copy-to-clipboard.git"},"keywords":["component","react-component","react","copy to clipboard","clipboard"],"author":{"name":"Nik Butenko","email":"nik@butenko.me"},"license":"MIT","bugs":{"url":"https://github.com/nkbt/react-copy-to-clipboard/issues"},"homepage":"https://github.com/nkbt/react-copy-to-clipboard","peerDependencies":{"react":">=15.3.0"},"dependencies":{"copy-to-clipboard":"^3.3.3","prop-types":"^15.8.1"},"devDependencies":{"@babel/cli":"^7.28.6","@babel/core":"^7.29.0","@babel/plugin-proposal-class-properties":"^7.18.6","@babel/plugin-proposal-object-rest-spread":"^7.20.7","@babel/preset-env":"^7.29.0","@babel/preset-react":"^7.28.5","@babel/register":"^7.28.6","@biomejs/biome":"^2.4.6","babel-loader":"^10.1.0","babel-plugin-transform-react-remove-prop-types":"^0.4.24","css-loader":"^7.1.4","depcheck":"^1.4.7","gh-pages":"^6.3.0","html-webpack-plugin":"^5.6.6","html-webpack-tags-plugin":"^3.0.2","mini-css-extract-plugin":"^2.10.0","react":"^19.2.4","react-dom":"^19.2.4","style-loader":"^4.0.0","tape":"^5.9.0","webpack":"^5.105.4","webpack-cli":"^6.0.1","webpack-dev-server":"^5.2.3"},"packageManager":"yarn@4.12.0","gitHead":"fcbce461e285bf21cf3fd17f6c83a6ffeb24c193","_id":"react-copy-to-clipboard@5.1.1","_nodeVersion":"24.12.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-s+HrzLyJBxrpGTYXF15dTgMjAJpEPZT/Yp6NytAtZMRngejxt6Pt5WrfFxLAcsqUDU6sY1Jz6tyHwIicE1U2Xg==","shasum":"76adb8be03616e99692fcf3f762365ed3fb5ff16","tarball":"http://registry-npm.ywwl.com/react-copy-to-clipboard/download/react-copy-to-clipboard-5.1.1.tgz","fileCount":10,"unpackedSize":37869,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD4dTyIE5aCPmYMeqh08YIKQ9OjO0olsfQyBP6tNf51uwIhAJQZzxfIIwYf56m2CI4ISQpiLCM5OPXhS3VTbXh8aHVb"}],"size":10308,"noattachment":false,"key":"/react-copy-to-clipboard/-/react-copy-to-clipboard-5.1.1.tgz"},"_npmUser":{"name":"nkbt","email":"nik@butenko.me"},"directories":{},"maintainers":[{"name":"nkbt","email":"nik@butenko.me"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/react-copy-to-clipboard_5.1.1_1772877850104_0.3015655818982048"},"_hasShrinkwrap":false,"readme":"# react-copy-to-clipboard [![npm](https://img.shields.io/npm/v/react-copy-to-clipboard.svg?style=flat-square)](https://www.npmjs.com/package/react-copy-to-clipboard)\n\n[![CircleCI](https://img.shields.io/circleci/project/nkbt/react-copy-to-clipboard.svg?style=flat-square)](https://circleci.com/gh/nkbt/react-copy-to-clipboard)\n\nCopy to clipboard React component\n\nBased on [copy-to-clipboard](https://npm.im/copy-to-clipboard)\n\n> Would try to use execCommand with fallback to IE specific clipboardData interface and finally, fallback to simple prompt with proper text content & 'Copy to clipboard: Ctrl+C, Enter'\n\n\n![Copy to clipboard](example/copy-to-clipboard.gif)\n\n\n## Installation\n\n### Yarn\n\n```sh\nyarn add react-copy-to-clipboard\n```\n\n### NPM\n\n```sh\nnpm install --save react-copy-to-clipboard\n```\n\nDon't forget to manually install peer dependencies (`react`) if you use npm@3.\n\n## Simple web demo\n\n[https://nkbt.github.io/react-copy-to-clipboard](https://nkbt.github.io/react-copy-to-clipboard)\n\n## Codepen demo\n\n[https://codepen.io/nkbt/pen/eNPoQv](https://codepen.io/nkbt/pen/eNPoQv?editors=0010)\n\n## Usage\n```js\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport {CopyToClipboard} from 'react-copy-to-clipboard';\n\nclass App extends React.Component {\n  state = {\n    value: '',\n    copied: false,\n  };\n\n  render() {\n    return (\n      <div>\n        <input value={this.state.value}\n          onChange={({target: {value}}) => this.setState({value, copied: false})} />\n\n        <CopyToClipboard text={this.state.value}\n          onCopy={() => this.setState({copied: true})}>\n          <span>Copy to clipboard with span</span>\n        </CopyToClipboard>\n\n        <CopyToClipboard text={this.state.value}\n          onCopy={() => this.setState({copied: true})}>\n          <button>Copy to clipboard with button</button>\n        </CopyToClipboard>\n\n        {this.state.copied ? <span style={{color: 'red'}}>Copied.</span> : null}\n      </div>\n    );\n  }\n}\n\nconst appRoot = document.createElement('div');\ndocument.body.appendChild(appRoot);\nReactDOM.render(<App />, appRoot);\n```\n\n## Options\n\n\n#### `text`: PropTypes.string.isRequired\n\nText to be copied to clipboard\n\n\n#### `onCopy`: PropTypes.func\n\nOptional callback, will be called when text is copied\n\n```\nonCopy(text, result)\n```\n`result (bool)`: Returns `true` if copied successfully, else `false`.\n\n\n#### `options`: PropTypes.shape({debug: bool, message: string, format: string})\n\nOptional [copy-to-clipboard](https://npm.im/copy-to-clipboard) options.\n\nSee [API docs](https://npm.im/copy-to-clipboard#api) for details\n\n#### `children`: PropTypes.element.isRequired\n\nCopyToClipboard is a simple wrapping component, it does not render any tags, so it requires the only child element to be present, which will be used to capture clicks.\n\n```js\n<CopyToClipboard text=\"Hello!\">\n  <button>Copy to clipboard</button>\n</CopyToClipboard>\n```\n\n## Development and testing\n\nCurrently is being developed and tested with the latest stable `Node` on `OSX`.\n\nTo run example covering all `CopyToClipboard` features, use `yarn start`, which will compile `example/Example.js`\n\n```bash\ngit clone git@github.com:nkbt/react-copy-to-clipboard.git\ncd react-copy-to-clipboard\nyarn install\nyarn start\n\n# then\nopen http://localhost:8080\n```\n\n## Tests\n\n```bash\n# to run Biome check\nyarn lint\n\n# to run tests\nyarn test\n```\n\n## License\n\nMIT\n","publish_time":1772877850249,"_cnpm_publish_time":1772877850249,"dist-tags":{"latest":"5.1.1"}}