{"id":16530569,"url":"https://github.com/freeshineit/react-clipboardjs-copy","last_synced_at":"2025-03-16T19:31:35.877Z","repository":{"id":32623460,"uuid":"138105248","full_name":"freeshineit/react-clipboardjs-copy","owner":"freeshineit","description":"react  copy/cut component","archived":false,"fork":false,"pushed_at":"2025-01-22T01:33:24.000Z","size":2703,"stargazers_count":14,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-07T08:36:42.906Z","etag":null,"topics":["clipboardjs","component-library","copy","cut","npm","react","react-dom"],"latest_commit_sha":null,"homepage":"https://freeshineit.github.io/react-clipboardjs-copy","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/freeshineit.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-21T01:42:28.000Z","updated_at":"2024-10-29T16:02:46.000Z","dependencies_parsed_at":"2024-04-29T16:56:00.855Z","dependency_job_id":"ae6e323c-f805-49a9-94dd-e0f5efa2ebea","html_url":"https://github.com/freeshineit/react-clipboardjs-copy","commit_stats":{"total_commits":150,"total_committers":3,"mean_commits":50.0,"dds":0.07999999999999996,"last_synced_commit":"f1596f5cb4105c6ab6ca70c049f15cf553b5e281"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freeshineit%2Freact-clipboardjs-copy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freeshineit%2Freact-clipboardjs-copy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freeshineit%2Freact-clipboardjs-copy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freeshineit%2Freact-clipboardjs-copy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/freeshineit","download_url":"https://codeload.github.com/freeshineit/react-clipboardjs-copy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243826780,"owners_count":20354220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clipboardjs","component-library","copy","cut","npm","react","react-dom"],"created_at":"2024-10-11T18:06:22.838Z","updated_at":"2025-03-16T19:31:35.563Z","avatar_url":"https://github.com/freeshineit.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-clipboardjs-copy\n\n![build](https://github.com/freeshineit/react-clipboardjs-copy/workflows/build/badge.svg) ![Download](https://img.shields.io/npm/dm/react-clipboardjs-copy.svg) ![Version](https://img.shields.io/npm/v/react-clipboardjs-copy.svg) ![License](https://img.shields.io/npm/l/react-clipboardjs-copy.svg)\n\nA react copy component that based on `clipboard.js`\n\n[中文](./README_zh-CN.md)\n\n## Installing\n\n```sh\nnpm install --save react-clipboardjs-copy\n```\n\n## Basic usage\n\n```jsx\nimport React from 'react';\nimport ReactClipboard from 'react-clipboardjs-copy';\nimport './App.css';\nexport default class App extends React.Component {\n  render() {\n    return (\n      \u003cdiv className=\"App\"\u003e\n        \u003csection className=\"app-item\"\u003e\n          \u003cdiv className=\"app-item-desc\"\u003eCopy text\u003c/div\u003e\n          \u003cReactClipboard text=\"copy text\" onSuccess={() =\u003e {}} onError={() =\u003e {}}\u003e\n            \u003cbutton\n              onClick={() =\u003e {\n                console.log('click button');\n              }}\n            \u003e\n              Copy Text\n            \u003c/button\u003e\n          \u003c/ReactClipboard\u003e\n        \u003c/section\u003e\n        \u003csection className=\"app-item\"\u003e\n          \u003cdiv className=\"app-item-desc\"\u003e\n            \u003ctextarea id=\"textarea\"\u003eMussum ipsum cacilds...\u003c/textarea\u003e\n            \u003cdiv /\u003e\n          \u003c/div\u003e\n          \u003cReactClipboard action=\"cut\" target=\"#textarea\" onSuccess={() =\u003e {}} onError={() =\u003e {}}\u003e\n            \u003cbutton\u003eCut\u003c/button\u003e\n          \u003c/ReactClipboard\u003e\n        \u003c/section\u003e\n      \u003c/div\u003e\n    );\n  }\n}\n```\n\n```jsx\n\u003cinput id=\"input\" value=\"git@github.com:freeshineit/react-clipboardjs-copy.git\" /\u003e\n\u003cReactClipboard\n  target=\"#input\"\n  onSuccess={handleSuccess}\n  onError={handleError}\n\u003e\n  \u003cbutton\u003e\n    Copy Input value\n  \u003c/button\u003e\n\u003c/ReactClipboard\u003e\n```\n\n## Options(props)\n\n| Property | Description | Type | Default |\n| --- | --- | --- | --- |\n| action | Overwrites default command (`cut` or `copy`) , Corresponding to clipboard.js attribute data-clipboard-action. | `cut` \\| `copy` | `copy` |\n| target | React component will copy target element content. Corresponding to `clipboard.js` attribute `data-clipboard-target`. | string \\| function(elem: Element): Element | - |\n| text | React component will copy content. Corresponding to `clipboard.js` attribute `data-clipboard-text` | string \\| function(elem: Element): string |  |\n| container | For use in Bootstrap Modals or with any other library that changes the focus you'll want to set the focused element as the container value. | Element | `body` |\n| selection | Setting whether to clear the copy or cut selected | boolean | false |\n| onSuccess | Operation success callback | function(event?: ClipboardJS.Event): void | - |\n| onError | Operation error callback | function(event?: ClipboardJS.Event): void | - |\n\n## Developing\n\n```sh\ngit clone git@github.com:freeshineit/react-clipboardjs-copy.git\n\ncd react-clipboardjs-copy\n\npnpm install\n\n## development\npnpm run dev\n\n## test\npnpm run test\n\n## production\npnpm run build\n```\n\n## Reference material\n\n[clipboard.js](https://clipboardjs.com/)\n\n## License\n\nMIT © [Shine Shao](https://github.com/freeshineit)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreeshineit%2Freact-clipboardjs-copy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreeshineit%2Freact-clipboardjs-copy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreeshineit%2Freact-clipboardjs-copy/lists"}