# Prompt Versions

A prompt's version history where the timeline is a line of eval scores: scrub or arrow between versions, metrics roll with their change, and a word diff sweeps in what was added and strikes through what was removed.

- Page and source: https://uibrik.com/components/prompt-versions
- Install (Pro, needs a license key, see https://uibrik.com/docs/pro): `npx shadcn@latest add @uibrik-pro/prompt-versions`
- Packages: none beyond React
- Import: `import { PromptVersions } from "@/components/uibrik/prompt-versions/prompt-versions"`

Where to use the Prompt Versions React component:

- **Prompt management tools**: Each version sits on its eval score, so teams see which edit helped and can restore it in one click. Pairs with [Code Block](https://uibrik.com/components/code-block).
- **LLM evaluation dashboards**: Score, tokens, latency and cost deltas next to the diff tie every metric change to the words that caused it. Pairs with [Benchmark Race](https://uibrik.com/components/benchmark-race) and [KPI Tile](https://uibrik.com/components/kpi-tile).
- **AI feature settings**: Users editing a system prompt get a readable history of what changed, by whom and when. Pairs with [Settings Page](https://uibrik.com/components/settings-page).

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| defaultView | `"changes" \| "full"` | `"changes"` | Open on the diff or the full prompt. |
| color | `string` | `"#5b7bd6"` | Colour of the score line and marker. |
| versions | `{ id; label; note?; author?; date?; prompt; score; tokens?; latency?: ms; cost?: USD }[]` |  | Oldest first. The last is the current version. |
| value / defaultValue / onValueChange | `string / string / (id) => void` |  | Selected version id. Defaults to the latest. |
| onRestore | `(version) => void` |  | Shows a Restore button on older versions. |
| diffWords | `(a, b) => DiffPart[]` |  | Exported word diff (LCS), if you want to render changes elsewhere. |
| className | `string` |  | Classes for the card. |
