Socket
Socket
Sign inDemoInstall

react-copy-to-clipboard

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-copy-to-clipboard

Copy-to-clipboard React component


Version published
Weekly downloads
961K
decreased by-22.1%
Maintainers
1
Weekly downloads
 
Created

What is react-copy-to-clipboard?

The react-copy-to-clipboard package provides a simple React component and hook to copy text to the clipboard. It leverages the Clipboard API and provides an easy-to-use interface for copying text within React applications.

What are react-copy-to-clipboard's main functionalities?

CopyToClipboard Component

This feature provides a React component that can wrap any element (like a button) to enable copying text to the clipboard when the element is clicked. The 'text' prop is the text to be copied, and the 'onCopy' prop is a callback function that is triggered after the text is copied.

{"<CopyToClipboard text={'Text to copy'} onCopy={() => console.log('Copied!')}><button>Copy to Clipboard</button></CopyToClipboard>"}

useCopyToClipboard Hook

This feature provides a React hook that can be used in functional components to copy text to the clipboard. The hook returns a copied state and a setCopied function that can be called with the text to be copied.

{"const [copied, setCopied] = useCopyToClipboard();\n<button onClick={() => setCopied('Text to copy')}>Copy to Clipboard</button>"}

Other packages similar to react-copy-to-clipboard

Keywords

FAQs

Package last updated on 12 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc