RedactAuto
Best-effort, post-render pattern scanning of a bounded DOM subtree.
<RedactProvider defaultEnabled mode="replace" autoDetect={['email']}>
<RedactAuto as="section"><Content /></RedactAuto>
</RedactProvider>RedactAuto inherits provider pattern configuration unless its patterns or customPatterns prop overrides it. The default built-ins are email, phone, SSN, credit-card, and IP. The wrapper defaults to div; use as="span" for inline layout where appropriate. blurRadius and maskChar override provider defaults.
Initial client scanning runs in a layout effect. Subsequent DOM mutations use a 100ms debounce. The original can exist in server HTML and between insertion and scanning. No mode, including secure, changes that lifecycle boundary. Use render-time demo fields and synthetic inputs for public demos.
All automatic restoration values stay in a WeakMap. No mode writes data-redact-original. Recognized matches get a safe accessible hidden-field label. Text nodes inside script/style/noscript are skipped; attributes, input values, shadow roots, frames, and images are not comprehensively scanned.
Custom regex must be trusted and avoid expensive backtracking. Empty matches are unsupported and stop processing that pattern on the current text node. Detection is heuristic and can miss information.