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-redact

v0.1.3

Published

One keyboard shortcut to make your entire app demo-safe

Readme

react-redact

npm version npm downloads bundle size TypeScript MIT License

One keyboard shortcut to make your entire app demo-safe.

Zero-dependency React components that visually hide PII — for demos, screenshares, and presentations.


Visual-only: This is a UI convenience tool for demos and screenshares. It does not remove data from the DOM.

Why react-redact?

You're about to share your screen. Your app is full of real customer data — emails, phone numbers, credit cards. You need to hide it now, not refactor your entire data layer.

react-redact solves this in one line: wrap your app in <RedactProvider>, press ⌘⇧X, and every marked piece of PII is instantly blurred, masked, or replaced with fake data. No backend changes. No environment switching. Just a keyboard shortcut.

Features

  • Instant toggle — Keyboard shortcut (⌘⇧X / Ctrl+Shift+X), useRedactMode() hook, or ?redact=true URL param
  • Three modes — Blur, mask (bullets), or replace with deterministic fake data
  • Manual wrapping<Redact> component for known PII fields
  • Auto-detection<RedactAuto> scans subtrees for email, phone, SSN, credit card, IP (+ custom regex)
  • Custom mode — Bring your own render function for full control
  • Zero dependencies — React is the only peer dep. ESM + CJS, tree-shakeable
  • Next.js ready"use client" directives included, works with App Router out of the box
  • TypeScript-first — Strict types, exported interfaces, isolatedDeclarations compatible

Install

npm install react-redact

Quick Start

import { RedactProvider, Redact, useRedactMode } from "react-redact";
import "react-redact/styles.css";

function App() {
  return (
    <RedactProvider shortcut="mod+shift+x">
      <Dashboard />
    </RedactProvider>
  );
}

function Dashboard() {
  const { isRedacted, toggle } = useRedactMode();
  return (
    <>
      <button onClick={toggle}>{isRedacted ? "🔒" : "🔓"} Demo mode</button>
      <p>Email: <Redact>[email protected]</Redact></p>
      <p>Phone: <Redact>(555) 123-4567</Redact></p>
    </>
  );
}

Press ⌘⇧X (Mac) or Ctrl+Shift+X (Windows/Linux) to toggle.

Modes

| Mode | What it does | Example output | |------|-------------|----------------| | Blur | CSS blur filter over original text | ░░░░░░░░░░░ | | Mask | Replaces each character with a bullet | ••••••••••• | | Replace | Deterministic fake data (same input → same output) | [email protected] |

<RedactProvider mode="blur">   {/* default */}
<RedactProvider mode="mask">
<RedactProvider mode="replace">

{/* Or per-component: */}
<Redact mode="replace">[email protected]</Redact>

Auto-Detection

<RedactAuto> scans DOM text nodes for PII patterns and wraps matches automatically:

<RedactAuto patterns={["email", "phone", "ssn", "credit-card", "ip"]}>
  <div>{/* any content — PII gets auto-wrapped */}</div>
</RedactAuto>

{/* Add custom patterns: */}
<RedactAuto customPatterns={[/ORDER-\d{6}/g]}>
  <div>Order: ORDER-123456</div>
</RedactAuto>

Built-in patterns: email · phone · ssn · credit-card (Luhn-validated) · ip

API at a Glance

| Export | Type | Description | |--------|------|-------------| | <RedactProvider> | Component | Context provider — wraps your app, configures mode/shortcut | | <Redact> | Component | Wraps known PII for manual redaction | | <RedactAuto> | Component | Scans a subtree and auto-wraps detected PII | | useRedactMode() | Hook | Returns { isRedacted, toggle, enable, disable } | | useRedactPatterns() | Hook | Read active patterns and add custom ones | | getInitialRedactEnabled() | Utility | Read ?redact=true from URL for initial state |

Documentation

Full docs, API reference, and interactive demos:

Contributing

Contributions are welcome! Please open an issue first to discuss what you'd like to change.

git clone https://github.com/btahir/react-redact.git
cd react-redact
pnpm install
pnpm run build
pnpm test:run

License

MIT