# sindresorhus/copy-text-to-clipboard

Copy text to the clipboard in modern browsers (0.2 kB)

Repository: https://github.com/sindresorhus/copy-text-to-clipboard
Canonical: https://ross.abutalabs.com/products/copy-text-to-clipboard
Language: JavaScript
License: MIT
License Family: permissive
Last push: 2026-02-02T12:31:39+00:00

## Health v2 (maintenance only)
Score: 66/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 65, release rhythm 48, longevity 100
- inputs: {"age_days": 3390, "days_push": 212, "days_rel": 344, "gap_med": 15, "n_releases_24m": 2}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1045, forks 222 (observed 2026-08-28T04:03:21.410432+00:00)

## What it is
A tiny (0.2 kB) JavaScript library for copying text to the clipboard in modern browsers. It works in non-secure contexts where the native navigator.clipboard API is unavailable.

## Use cases
- copy text to clipboard on button click in a web app
- clipboard copy fallback for non-HTTPS sites
- copy code snippets to clipboard in documentation sites
- copy text inside a modal with a focus trap
- lightweight alternative to clipboard.js

## When to choose
- you need a minimal, dependency-free clipboard copy solution for the browser
- your site runs in non-secure contexts (HTTP) where navigator.clipboard is unavailable
- you need to copy text from within a focus trap like a modal

## When to avoid
- you only target secure contexts and can use navigator.clipboard.writeText directly
- you need clipboard access in Node.js (use clipboardy instead)
- you need copy/paste of rich content like images or HTML

## Facets
- artifact type: library
- maturity: stable
- function: ui-components
- domain: web-development, frontend, browser-extensions
- platform: browser
- tags: clipboard, copy-to-clipboard, tiny, zero-dependency, browser-api, javascript

## Member repositories
- sindresorhus/copy-text-to-clipboard (main) score 66

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:21.410432+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T07:02:08.334381+00:00, confidence not recorded.
  - readme: https://github.com/sindresorhus/copy-text-to-clipboard (fetched 2026-08-28T04:03:21.410432+00:00, sha 12efbf45f411)
  - registry_npm: https://registry.npmjs.org/copy-text-to-clipboard (fetched 2026-08-29T13:03:02.024301+00:00, sha 41aa83d22810)
- Data as of 2026-08-30T08:39:29.467469+00:00.
