DOCS
v0.4

AI Components / Diff Panel

Diff Panel

Side-by-side or inline text diff with additions, removals, and change statistics.

ai-workflowv0.3.0

Playground

Examples

Side-by-side
<ai-diff-panel title="Prompt v1 → v2" style="max-width:600px;"></ai-diff-panel>
Inline
<ai-diff-panel title="Code review" mode="inline" style="max-width:600px;"></ai-diff-panel>

Import

import { AiDiffPanel } from '@cognivo/components';
// Or tree-shake: import '@cognivo/components/ai-diff-panel';

Per-component imports ship only that component (~8 kB gzip).

API Reference

PropTypeDefaultDescription
beforeCodestringText before changes
afterCodestringText after changes
mode"side-by-side" | "inline""side-by-side"Split or inline view
titlestring"Comparison"Panel title

Events

EventDetailDescription
ai-diff-select{type, content, lineNum}Diff line clicked