Guardrail logPro
Blocked, modified or flagged text with the rule, the excerpt with the catch marked, and an override that needs a reason and leaves an audit line.
On this page
ProA rewrite, a block, an overridden false positive and a flag. Override needs a reason.
Installation
Usage
import { GuardrailLog } from "@/components/ui/chatcn/pro/guardrail-log"
<GuardrailLog entries={events} onOverride={(id, reason) => release(id, reason)} />Blocked text is marked with a red wavy underline, rewrites strike the original and show what replaced it, flags get an amber tint. Override opens an inline form that needs a written reason; the entry then shows who overrode it, when and why.
Examples
States
ProRead only and filtered, loading and nothing caught yet.
Props
| Prop | Type | Notes |
|---|---|---|
entries | GuardrailEntry[] | { id, at, rule, action, direction, excerpt, matches?, replacement?, traceId?, override? } |
onOverride | (id, reason) => void | Adds Override to blocked and flagged entries |
minReason | number | Shortest reason accepted. Default 12 |
filter, defaultFilter, onFilterChange | "all" | "blocked" | "modified" | "flagged" | |
now, loading, labels |
Keyboard
| Key | Action |
|---|---|
Cmd Enter, Ctrl Enter in the reason | Release the output |
Esc in the form | Cancel and return focus to Override |
Accessibility
- Marked text names itself for screen readers: caught, removed or replaced with.
- A short reason sets
aria-invalidand the hint below says how to fix it.