> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cskn.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Clipboard

> Copy text to and read text from the system clipboard.

```tsx theme={null}
import { useClipboard } from '@cskn/sdk';

function CopyLink({ url }: { url: string }) {
  const clipboard = useClipboard();
  return <button onClick={() => clipboard.write(url)}>Copy link</button>;
}
```

| Hook method | Function | Returns |
| - | - | - |
| `write(text)` | `writeToClipboard(text)` | `void` |
| `read()` | `readFromClipboard()` | `Promise<string \| null>` |

In a browser, `write` does nothing and `read` resolves `null`. Use `navigator.clipboard` there:

```tsx theme={null}
import { isAvailable, writeToClipboard } from '@cskn/sdk';

function copy(text: string) {
  if (isAvailable()) writeToClipboard(text);
  else void navigator.clipboard.writeText(text);
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.