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.
- clipboard-copy — Minimal clipboard write utility using the modern Clipboard API with
execCommandfallback. Last updated 2020. - copy-to-clipboard — Clipboard write utility with broad browser support via
execCommand. Last updated 2022.
- react-copy-to-clipboard — Render-prop React component for clipboard copy operations.
- usehooks-ts
useClipboard— Clipboard hook included in theusehooks-tsmulti-utility collection. TypeScript-native. - react-use
useClipboard— Clipboard hook included in thereact-usemulti-utility collection.
- @vueuse/core
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.