Skip to content

Revision History

The saved versions of a post: who saved each one and when, a word by word comparison of any two, and a restore that asks first and can be undone. Controlled: you pass the revisions and an async restore, and the new current version back.

On this page
Used for
  • Content management
  • Post editor
  • Docs and wikis
  • Undoing a bad save
  • Reviewing who changed what

Examples

Compare with

On a phone

Installation

Installation is part of Pro

Pro components install from a licensed registry. The live preview stays open to everyone.

Props

revisions
Revision[]
The saved versions. A revision has id, createdAt, author, kind (manual or autosave), text, and optionally label (a name for a manual save) and title.
currentId
string
Defaultnewest
The version that is live. It shows a Current badge and cannot be restored.
onRestore
(id) => void | Promise
Restores a version. Called again with the previous current id when the person presses Undo. A rejection keeps the dialog open with the error. Without it the Restore button is hidden.
undoMs
number
Default8000
How long the Undo bar stays.
base / defaultBase / onBaseChange
"previous" | "current" | id
Default"previous"
What the selected version is compared with.
selectedId / defaultSelectedId / onSelectedChange
string
Defaultnewest
The version shown, controlled or not.
showAutosaves / defaultShowAutosaves / onShowAutosavesChange
boolean
Defaultfalse
Whether autosaves are listed.
loading
boolean
Defaultfalse
Shows skeleton rows.
now
number
Fixes the clock for the day headings, for tests and screenshots.

Keyboard and accessibility

  • The arrow keys, Home and End move through the list; the open version is marked with aria-current and is the one tab stop.
  • The word count of the comparison is a polite status, so a change of version is announced.
  • Added and removed words are underlined and struck through as well as coloured, so the diff does not depend on colour.
  • The restore dialog traps focus, names the version, and returns focus to the Restore button.

What it handles

  1. 01Lists the saved versions of a document grouped by day, with who saved each one, the time, and whether it was a manual save or an autosave.
  2. 02Hides autosaves until asked, but never hides the version the person is looking at or the current one.
  3. 03Compares the selected version with the one before it, the current one or any other, as a word diff built with Prose Diff, with long unchanged stretches folded and a count of words added and removed.
  4. 04Restores a version only after a confirm that names it. The call is async: the dialog shows progress and keeps its error if the save fails.
  5. 05Offers Undo for a few seconds after a restore, which restores the version that was current before. A failed undo says so and keeps the bar.
  6. 06Stacks the list above the comparison on a narrow container and moves with the arrow keys.

States

First render
Nothing. The list and the diff paint as they are
none
Hover
Row and button colour change
120ms, ease out
Select a version
The comparison swaps at once
none
Restore
A confirm dialog; the button shows a spinner while the call runs
180ms, ease out
Restored
An Undo bar appears above the comparison and goes after the undo window
none
Restore fails
The dialog stays with an error line and Restore again
none
Reduced motion
The dialog appears at once
0ms

Works with

When to use

When to use

  • The saved versions of a post or a page, with who saved each, a comparison of any two and a restore that can be undone.
  • A review of what changed since the last published version.

When not to use

  • Showing one change inline in a draft.
  • A diff of code: use Inline Diff.

Using with AI

Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:

  • Add the Knowns UI Revision History to my app and wire it to my own data.
  • I need the saved versions of a post or a page, with who saved each, a comparison of any two and a restore that can be undone. Set that up with the Knowns UI Revision History.
  • Which Revision History props do I need for a minimal setup? Show me a short example.

With the server connected, your assistant calls get_component({ name: "revision-history" }) and search_docs({ query: "revision history" }). Pro props, full examples and source come back once your license key is in the MCP config.

Need help?

Stuck on Revision History, or found something off? We read every message.