{"id":13515044,"url":"https://github.com/github/clipboard-copy-element","last_synced_at":"2025-05-13T22:09:24.428Z","repository":{"id":37549986,"uuid":"123195915","full_name":"github/clipboard-copy-element","owner":"github","description":"Copy element text content or input values to the clipboard.","archived":false,"fork":false,"pushed_at":"2025-04-14T20:34:52.000Z","size":1724,"stargazers_count":473,"open_issues_count":2,"forks_count":261,"subscribers_count":315,"default_branch":"main","last_synced_at":"2025-04-30T15:18:50.810Z","etag":null,"topics":["custom-elements","web-components"],"latest_commit_sha":null,"homepage":"https://github.github.io/clipboard-copy-element/examples/","language":"JavaScript","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/github.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-02-27T22:21:36.000Z","updated_at":"2025-04-27T22:50:11.000Z","dependencies_parsed_at":"2024-09-27T05:09:39.396Z","dependency_job_id":"a8aca283-6eed-47c9-8a57-0d108529fa5c","html_url":"https://github.com/github/clipboard-copy-element","commit_stats":{"total_commits":161,"total_committers":12,"mean_commits":"13.416666666666666","dds":0.7391304347826086,"last_synced_commit":"4d8e6507628fee8962f5e5fa543daa7e0302a56d"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fclipboard-copy-element","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fclipboard-copy-element/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fclipboard-copy-element/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fclipboard-copy-element/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/github","download_url":"https://codeload.github.com/github/clipboard-copy-element/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254036830,"owners_count":22003654,"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":["custom-elements","web-components"],"created_at":"2024-08-01T05:01:05.629Z","updated_at":"2025-05-13T22:09:19.403Z","avatar_url":"https://github.com/github.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Utility Elements"],"sub_categories":[],"readme":"# \u0026lt;clipboard-copy\u0026gt; element\n\nCopy element text content or input values to the clipboard.\n\n## Installation\n\n```\n$ npm install --save @github/clipboard-copy-element\n```\n\n## Usage\n\n### Script\n\nImport as ES modules:\n\n```js\nimport '@github/clipboard-copy-element'\n```\n\nWith a script tag:\n\n```html\n\u003cscript type=\"module\" src=\"./node_modules/@github/clipboard-copy-element/dist/index.js\"\u003e\n```\n\n### Markup\n\n```html\n\u003cclipboard-copy for=\"blob-path\" class=\"btn btn-sm BtnGroup-item\"\u003e\n  Copy path\n\u003c/clipboard-copy\u003e\n\u003cdiv id=\"blob-path\"\u003esrc/index.js\u003c/div\u003e\n```\n\n## Data sources\n\n### Attribute\n\n```html\n\u003cclipboard-copy value=\"src/index.js\"\u003eCopy\u003c/clipboard-copy\u003e\n```\n\n### Element content\n\n```html\n\u003cclipboard-copy for=\"blob-path\"\u003eCopy\u003c/clipboard-copy\u003e\n\u003cdiv id=\"blob-path\"\u003esrc/index.js\u003c/div\u003e\n```\n\n### Form input\n\n```html\n\u003cclipboard-copy for=\"blob-path\"\u003eCopy\u003c/clipboard-copy\u003e\n\u003cinput id=\"blob-path\" value=\"src/index.js\"\u003e\n```\n\n### Hyperlink href\n\n```html\n\u003cclipboard-copy for=\"blob-path\"\u003eCopy full URL\u003c/clipboard-copy\u003e\n\u003ca id=\"blob-path\" href=\"/path/to#my-blob\"\u003eLink text will not be copied\u003c/a\u003e\n```\n\n## Events\n\nAfter copying to the clipboard, a `clipboard-copy` event is dispatched from\nthe `\u003cclipboard-copy\u003e` element:\n\n```js\ndocument.addEventListener('clipboard-copy', function(event) {\n  const button = event.target\n  button.classList.add('highlight')\n})\n```\n\n## Browser support\n\nBrowsers without native [custom element support][support] require a [polyfill][].\n\n- Chrome\n- Firefox\n- Safari\n- Microsoft Edge\n\n[support]: https://caniuse.com/#feat=custom-elementsv1\n[polyfill]: https://github.com/webcomponents/polyfills/tree/master/packages/custom-elements\n\n## Development\n\n```\nnpm install\nnpm test\n```\n\n## License\n\nDistributed under the MIT license. See LICENSE for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fclipboard-copy-element","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgithub%2Fclipboard-copy-element","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fclipboard-copy-element/lists"}