Privacy maskNew
A frosted optical unmasker for sensitive keys, salaries and tokens, with auto-hide timeout and one-tap copy.
Used forAPI keys & developer settingsFintech & banking dashboardsHR & payroll recordsAuth & recovery tokens
Install with the shadcn CLI
Where it’s used
API keys & developer settings
Protect live Stripe, OpenAI, and database secret keys from accidental exposure.
Fintech & banking dashboards
Conceal total net worth, bank account numbers, and portfolio balances during screen sharing.
HR & payroll records
Mask employee base compensation and equity allocations in team directories.
Auth & recovery tokens
Show two-factor backup recovery codes with one-tap copy and instant re-masking.
What it handles for you
Developers often hack together a simple show/hide toggle that replaces the text completely or causes layout jumps when changing string lengths. Privacy mask preserves the exact physical dimensions of the text with optical blur, handles clipboard feedback, and includes auto re-mask safety timers.
Optical blur preserves width
The 5px blur applies directly over the real string, so the component never shifts width or changes height between masked and unmasked states.
Multiple reveal triggers
Supports click-to-toggle, hover-to-peek, and hold-to-reveal for varying levels of security sensitivity.
Self-drawing copy checkmark
Copying the secret draws a crisp SVG checkmark and resets to the clipboard icon after 1.8 seconds.
Auto re-mask safety net
Automatically re-masks the value after 6 seconds of inactivity to prevent leaving sensitive keys exposed on open tabs.
Instant Escape dismiss
Pressing Escape immediately re-applies the mask and returns keyboard focus cleanly.
Screen reader privacy
Announces "Hidden" when masked, preventing screen readers from speaking private keys aloud in public spaces.
Overview
Showing raw API keys, account balances, or employee salaries in screenshares, live demos, or co-working spaces creates immediate privacy risks. Privacy mask keeps confidential strings behind an optical 5px blur or bullet dots. A click, hover, or hold dissolves the blur in 200ms while the eye icon cross-fades to eye-off. One tap copies the secret with a self-drawing checkmark, and an auto-hide timer or Escape key re-masks the value immediately.
States
- masked
- Frosted 5px optical blur with 60% opacity keeps text confidential while maintaining exact character width.
- revealed
- Blur dissolves to 0px over 200ms with cubic-bezier(0.16,1,0.3,1); eye icon cross-fades into eye-off.
- copied
- Copy button swaps to an emerald checkmark that draws its path in 320ms and restores after 1.8s.
- auto re-mask
- Timer automatically returns to masked state after 6000ms of inactivity.
- escape dismiss
- Escape key immediately cancels the unmasked state without waiting for the timer.
Usage
Developer settings page with API secret keys
Display sensitive live production API credentials safely. Keys remain masked by default, and developers can copy or inspect them with automatic re-masking.
Props
| Prop | Type | Description |
|---|---|---|
| value | string | The sensitive string to be masked and copied. |
| label | stringdefault "Confidential value" | Accessible label for assistive technologies. |
| trigger | "click" | "hover" | "hold"default "click" | How the unmasking interaction is initiated. |
| maskStyle | "blur" | "dots" | "truncate"default "blur" | Visual mask format: optical blur, bullet dots, or truncated token. |
| autoHideMs | numberdefault 6000 | Milliseconds before automatically re-masking (0 disables). |
| copyable | booleandefault true | Shows an integrated copy button with self-drawing checkmark. |
Accessibility and motion
- Preserves exact horizontal character metrics to prevent layout shifts across sibling components.
- Screen reader status region politely reports "Hidden" until explicitly revealed by user action.
- Clipboard copy cleans up asynchronous timeouts on component unmount.
- Reduced motion eliminates blur transitions and updates text states instantaneously.
Requirements
React 19, Tailwind CSS v4 and shadcn/ui theme variables (any style, light and dark). Icons from lucide-react.
Source
Registry item: /r/privacy-mask.json