

Custom hook that copies text to the clipboard using the [`Clipboard API`](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API).

## Usage [#usage]

```tsx
import { useCopyToClipboard } from "@tilt-legal/cubitt-components/utilities/hooks";

const [copiedText, copyToClipboard] = useCopyToClipboard();
const textToCopy = 'Hello, world!';

// Attempt to copy text to the clipboard
copyToClipboard(textToCopy)
  .then(success => {
    if (success) {
      console.log(`Text "${textToCopy}" copied to clipboard successfully.`);
    } else {
      console.error('Failed to copy text to clipboard.');
    }
  });
```

## API [#api]

### Signature [#signature]

```ts
declare function useCopyToClipboard(): [CopiedValue, CopyFn];
```

### Parameters [#parameters]

This hook takes no arguments.

### Return Value [#return-value]

| Value    | Type                    | Description                                                                       |
| -------- | ----------------------- | --------------------------------------------------------------------------------- |
| `return` | `[CopiedValue, CopyFn]` | An tuple containing the copied text and a function to copy text to the clipboard. |
