React hook that wraps the browser Clipboard API, providing toast notifications on success or failure and a timed `copied` state reset. ## Key Components | Export | Type | Description | |--------|------|-------------| | `useCopyToClipboard` | Hook | Copies text to clipboard with toast feedback and `copied` state | | `UseCopyToClipboardOptions` | Interface | Configuration options for toast messages and reset delay | **Options:** | Option | Default | Description | |--------|---------|-------------| | `successTitle` | `'Copied'` | Toast title on success | | `successDescription` | `'Copied to clipboard'` | Toast body on success | | `errorTitle` | `'Copy failed'` | Toast title on failure | | `errorDescription` | `'Could not copy to clipboard'` | Toast body on failure | | `resetDelay` | `2000` | Milliseconds before `copied` resets to `false` | **Returns:** `{ copy, copied }` — the async copy function and a boolean state flag. ## Usage Example ```typescript import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard'; function ApiKeyDisplay({ apiKey }: { apiKey: string }) { const { copy, copied } = useCopyToClipboard({ successTitle: 'API Key Copied', resetDelay: 3000, }); return ( ); } ``` > **Note:** This hook is client-only (`'use client'`). It depends on `navigator.clipboard`, which requires a secure context (HTTPS or localhost). Failures are caught silently and surfaced via the destructive toast variant.