Redact
Manually wrap content to be redacted when demo mode is on.
Redact
Wrap any content to be visually redacted when redact mode is enabled.
Usage
import { Redact } from 'react-redact';
<Redact>user@company.com</Redact>
<Redact mode="mask">4111 1111 1111 1111</Redact>
<Redact mode="replace" replacement="Jane Smith">John Doe</Redact>Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | Content to redact |
mode | 'blur' | 'mask' | 'replace' | 'custom' | from context | How to display when redacted |
replacement | string | — | For mode="replace": custom replacement text |
renderRedacted | (props: { children, text }) => ReactNode | — | For mode="custom": your render function. Overrides provider customRender. |
Modes
- blur —
filter: blur(6px); original text remains in DOM. - mask — Bullets matching character length (
chunits). - replace — Swap with
replacementprop or deterministic fake data (whenchildrenis a string). - custom — Use
renderRedacted(or providercustomRender). Your node should havedata-redactandaria-hidden.
When redact mode is off, children render as-is with no wrapper.