# 📋 react-use-clipboard
[](https://www.npmjs.com/package/react-use-clipboard) [](https://github.com/danoc/react-use-clipboard/actions?query=workflow%3ATest) [](https://bundlephobia.com/result?p=react-use-clipboard) [](https://bundlephobia.com/result?p=react-use-clipboard)
> A React Hook that provides copy to clipboard functionality.
## Install
You can install `react-use-clipboard` with NPM or Yarn.
```bash
npm install react-use-clipboard
```
```bash
yarn add react-use-clipboard
```
## Usage
Here's how to use `react-use-clipboard`:
```jsx
import useClipboard from "react-use-clipboard";
function App() {
const [isCopied, setCopied] = useClipboard("Text to copy");
return (
);
}
```
You can reset the `isCopied` value after a certain amount of time with the `successDuration` option.
```jsx
import useClipboard from "react-use-clipboard";
function App() {
const [isCopied, setCopied] = useClipboard("Text to copy", {
// `isCopied` will go back to `false` after 1000ms.
successDuration: 1000,
});
return (
);
}
```
This package only works in versions of React that support Hooks.