npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-anticapture

v0.1.5

Published

A lightweight React component that helps prevent users from capturing (copying, selecting, printing, or screenshotting) sensitive information rendered on your website. Perfect for privacy, security, and content protection in React applications.

Readme

React Anticapture

npm version CI Storybook deploy

NPM: react-anticapture
A lightweight React component that helps prevent users from capturing (copying, selecting, or screenshotting) sensitive information rendered on your website.

demo


✨ Overview

React Anticapture provides a drop-in <AntiCapture> component that you can wrap around any part of your React app to strongly discourage or block screen capture, selection, and copying of sensitive content.
It’s designed for scenarios where you want to provide an extra layer of deterrence for confidential UI sections.


🚀 Features

  • Block Text Selection & Copying: Prevents text selection and copying inside wrapped content.
  • Screenshot Deterrence: Applies CSS and event-based tricks to discourage screenshots (e.g., blur overlays, keyboard shortcut interception).
  • Block Context Menu: Disables right-click/context menu to make copying harder.
  • Clipboard Protection: Optionally blocks clipboard copy/paste.
  • Devtools Detection: (Optional) Can attempt to block/alert on devtools opening.
  • Lightweight: Zero dependencies, works with any React project (TypeScript & JavaScript).
  • Highly Configurable: Use props to customize behavior per use-case.

📦 Installation

pnpm add react-anticapture
# or
npm install react-anticapture
# or
yarn add react-anticapture

🛡 Usage

Simply import and wrap any sensitive page or component within <AntiCapture>:

import { AntiCapture } from 'react-anticapture';

function ConfidentialSection() {
  return (
    <AntiCapture>
      <h2>Confidential Information</h2>
      <p>
        This section contains sensitive information. Copying, selecting, and screenshots are discouraged.
      </p>
    </AntiCapture>
  );
}

You can also combine props to fine-tune the deterrence:

<AntiCapture
  screenshotPrevent={true}
  clipboardPrevent={true}
  devtoolsPrevent={true}
  userSelect={false}
>
  <SecretStuff />
</AntiCapture>

⚙️ Props

| Prop | Type | Default | Description | |--------------------|-----------------------|---------|--------------------------------------------------------------------------------------------------| | screenshotPrevent | boolean | true | Prevents common screenshot and screen recording keyboard shortcuts (PrintScreen, Cmd+Shift+4, etc).| | userSelect | boolean | true | If true, allows user text selection. Set to false to block selection via CSS. | | targetClick | HTMLElement | null | null | Optional target element for dismissing blur overlay. Defaults to component's internal wrapper. | | clipboardPrevent | boolean | false | If true, prevents clipboard copy/paste actions and context menu inside the component. | | devtoolsPrevent | boolean | false | If true, detects and attempts to prevent developer tools from being open. |


⚠️ Limitations & Caveats

  • No client-side solution can provide 100% protection against screenshots or determined users with advanced tools. This library is a deterrent, not a guarantee.
  • Some techniques may not work in all browsers or may be bypassed by browser extensions, accessibility tools, or OS-level features.
  • Use with consideration for user experience; some users dislike aggressive anti-capture measures.

🖥 Demo

Try it out instantly via Storybook:
Live Demo


📚 Related Links


📄 License

MIT


Inspired by modern needs for client-side data privacy and protection.