AI Components / Prompt Editor
Prompt Editor
Prompt version editor with 3 modes: view (read-only), edit (always-on textarea), split (side-by-side edit + preview).
ai-workflow v0.3.0
Playground
Examples
View (read-only)
<ai-prompt-editor mode="view" style="height:340px;"></ai-prompt-editor> Edit (always-on)
<ai-prompt-editor mode="edit" style="height:380px;"></ai-prompt-editor> Split (edit + preview)
<ai-prompt-editor mode="split" style="height:380px;"></ai-prompt-editor> Import
import { AiPromptEditor } from '@cognivo/components'; // Or tree-shake: import '@cognivo/components/ai-prompt-editor'; Per-component imports ship only that component (~8 kB gzip).
API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
versions | PromptVersion[] | — | Versions — {id, content, timestamp, author?, active?} |
mode | "view" | "edit" | "split" | "view" | View = read-only, Edit = always-on textarea, Split = edit + live preview |
Events
| Event | Detail | Description |
|---|---|---|
ai-prompt-save | {versionId, content} | When saved |
ai-prompt-activate | {versionId} | When activated |