Skip to content

anIcedAntFA/ctc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

249 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“‹ @ngockhoi96/ctc

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.

npm version Bundle Size npm downloads React Vue Svelte TypeScript tree-shakeable Coverage CI Release License: MIT

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.

Packages

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

Quick Start

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.

Monorepo Structure

.
β”œβ”€β”€ 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.

Browser Support

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.

Similar / Related Projects

The following libraries solve clipboard operations in similar or overlapping ways. Listed here for reference β€” see BENCHMARKS.md for a detailed comparison table.

Framework-agnostic

  • clipboard-copy β€” Minimal clipboard write utility using the modern Clipboard API with execCommand fallback. Last updated 2020.
  • copy-to-clipboard β€” Clipboard write utility with broad browser support via execCommand. Last updated 2022.

React

Vue

  • @vueuse/core useClipboard β€” Clipboard composable included in the VueUse collection of Vue 3 utilities. TypeScript-native.

Svelte

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.

License

MIT

About

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.

Topics

Resources

Contributing

Security policy

Stars

Watchers

Forks

Releases

Contributors

Languages