{"id":13450523,"url":"https://github.com/danoc/react-use-clipboard","last_synced_at":"2025-05-16T06:00:22.317Z","repository":{"id":38272788,"uuid":"168096578","full_name":"danoc/react-use-clipboard","owner":"danoc","description":"React hook that provides copy to clipboard functionality.","archived":false,"fork":false,"pushed_at":"2023-10-24T23:06:26.000Z","size":1243,"stargazers_count":265,"open_issues_count":7,"forks_count":15,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-15T20:53:17.482Z","etag":null,"topics":["clipboard","component","hooks","react"],"latest_commit_sha":null,"homepage":null,"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/danoc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-01-29T05:43:03.000Z","updated_at":"2024-11-17T11:35:23.000Z","dependencies_parsed_at":"2024-03-08T14:15:21.411Z","dependency_job_id":null,"html_url":"https://github.com/danoc/react-use-clipboard","commit_stats":{"total_commits":96,"total_committers":9,"mean_commits":"10.666666666666666","dds":"0.41666666666666663","last_synced_commit":"0bbd06402380ef41eee0bf8a00c7de9910336379"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danoc%2Freact-use-clipboard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danoc%2Freact-use-clipboard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danoc%2Freact-use-clipboard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danoc%2Freact-use-clipboard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danoc","download_url":"https://codeload.github.com/danoc/react-use-clipboard/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254478160,"owners_count":22077675,"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":["clipboard","component","hooks","react"],"created_at":"2024-07-31T07:00:35.611Z","updated_at":"2025-05-16T06:00:22.257Z","avatar_url":"https://github.com/danoc.png","language":"TypeScript","funding_links":[],"categories":["Packages","TypeScript"],"sub_categories":[],"readme":"# 📋 react-use-clipboard\n\n[![NPM version](https://badgen.net/npm/v/react-use-clipboard)](https://www.npmjs.com/package/react-use-clipboard) [![Test build status](https://github.com/danoc/react-use-clipboard/workflows/Test/badge.svg)](https://github.com/danoc/react-use-clipboard/actions?query=workflow%3ATest) [![Bundle size](https://badgen.net/bundlephobia/min/react-use-clipboard?label=size)](https://bundlephobia.com/result?p=react-use-clipboard) [![Bundle size](https://badgen.net/bundlephobia/minzip/react-use-clipboard?label=gzip%20size)](https://bundlephobia.com/result?p=react-use-clipboard)\n\n\u003e A React Hook that provides copy to clipboard functionality.\n\n## Install\n\nYou can install `react-use-clipboard` with npm, Yarn, or pnpm.\n\n```bash\nnpm install react-use-clipboard\nyarn add react-use-clipboard\npnpm install react-use-clipboard\n```\n\n## Usage\n\nHere's how to use `react-use-clipboard`:\n\n```jsx\nimport useClipboard from \"react-use-clipboard\";\n\nfunction App() {\n  const [isCopied, setCopied] = useClipboard(\"Text to copy\");\n\n  return (\n    \u003cbutton onClick={setCopied}\u003e\n      Was it copied? {isCopied ? \"Yes! 👍\" : \"Nope! 👎\"}\n    \u003c/button\u003e\n  );\n}\n```\n\nYou can reset the `isCopied` value after a certain amount of time with the `successDuration` option.\n\n```jsx\nimport useClipboard from \"react-use-clipboard\";\n\nfunction App() {\n  const [isCopied, setCopied] = useClipboard(\"Text to copy\", {\n    // `isCopied` will go back to `false` after 1000ms.\n    successDuration: 1000,\n  });\n\n  return (\n    \u003cbutton onClick={setCopied}\u003e\n      Was it copied? {isCopied ? \"Yes! 👍\" : \"Nope! 👎\"}\n    \u003c/button\u003e\n  );\n}\n```\n\nThis package only works in versions of React that support Hooks.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanoc%2Freact-use-clipboard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanoc%2Freact-use-clipboard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanoc%2Freact-use-clipboard/lists"}