SSE Hooks

useCopyToClipboard

Custom hook that copies text to the clipboard using the [Clipboard API](https://developer.

Installation

npx sse-tool add use-copy-to-clipboard

Usage

import { useCopyToClipboard } from "./{hooks file}";

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

Return Value

Returns any.

An tuple containing the copied text and a function to copy text to the clipboard.

Changelog

c165d — feat: enhance useRoleGuard and useSSR hooks with additional options and documentation

30da4 — feat: add new hooks and their metadata

cf13e — feat: add custom hooks for step navigation, ternary dark mode, timeout, toggle, unmount, and window size

Built with Love • © 2026