Modular, tree-shakeable browser utilities monorepo. Core clipboard APIs plus idiomatic framework adapters for React, Vue, and Svelte. Zero runtime dependencies, SSR-safe, framework-agnostic.
Why ctc? Modern Clipboard API under the hood, SSR-safe out of the box, TypeScript-native with zero
any, multi-framework adapters that share a zero-dependency core, and fully tree-shakeable. See full comparison ā
All functions are SSR-safe -- safe to import in Next.js, Nuxt, or any server-side environment without crashing.
| Package | Description | Install |
|---|---|---|
@ngockhoi96/ctc |
Core clipboard utilities (copy, read, detect) | pnpm add @ngockhoi96/ctc |
@ngockhoi96/ctc-react |
React hook useCopyToClipboard |
pnpm add @ngockhoi96/ctc-react @ngockhoi96/ctc |
@ngockhoi96/ctc-vue |
Vue 3 composable useCopyToClipboard |
pnpm add @ngockhoi96/ctc-vue @ngockhoi96/ctc |
@ngockhoi96/ctc-svelte |
Svelte action + rune/store | pnpm add @ngockhoi96/ctc-svelte @ngockhoi96/ctc |
import { copyToClipboard, isClipboardSupported } from '@ngockhoi96/ctc/clipboard'
button.addEventListener('click', async () => {
if (isClipboardSupported()) {
const success = await copyToClipboard('Hello, world!')
console.log(success ? 'Copied!' : 'Copy failed')
}
})
For framework-idiomatic usage, see the React, Vue, or Svelte package README linked above.
For the full API reference (all five functions, error codes, options), see packages/core/README.md.
.
āāā packages/
ā āāā core/ # @ngockhoi96/ctc ā clipboard utilities
ā āāā react/ # @ngockhoi96/ctc-react ā React hook
ā āāā vue/ # @ngockhoi96/ctc-vue ā Vue composable
ā āāā svelte/ # @ngockhoi96/ctc-svelte ā action + rune
āāā playground/ # standalone Vite apps per framework
āāā .changeset/ # versioning + changelog config
Built with pnpm workspaces + Turborepo. See CONTRIBUTING.md for setup.
| Function | Chrome | Firefox | Safari | HTTP Support |
|---|---|---|---|---|
copyToClipboard |
66+ | 63+ | 13.1+ | No (use legacy) |
readFromClipboard |
66+ | 63+ | 13.1+ | No |
isClipboardSupported |
66+ | 63+ | 13.1+ | Returns false |
isClipboardReadSupported |
66+ | 63+ | 13.1+ | Returns false |
copyToClipboardLegacy |
All | All | Partial | Yes |
All functions require ES2020+ (>95% global browser support).
All functions are SSR-safe and will return false or null when called in a server-side environment (Node.js, Deno, Bun) without crashing.
The following libraries solve clipboard operations in similar or overlapping ways. Listed here for reference ā see BENCHMARKS.md for a detailed comparison table.
execCommand fallback. Last updated 2020.execCommand. Last updated 2022.useClipboard ā Clipboard hook included in the usehooks-ts multi-utility collection. TypeScript-native.useClipboard ā Clipboard hook included in the react-use multi-utility collection.useClipboard ā Clipboard composable included in the VueUse collection of Vue 3 utilities. TypeScript-native.The Svelte clipboard ecosystem is sparse. The Svelte docs show how to write a clipboard action natively; no widely-maintained dedicated library exists as of 2026.