Skip to content

VersionsPanel ​

VersionsPanel is the list of the saved versions of a document, with the actions to look at one and to restore it.

When to use ​

Use it for the history of a document. The application passes the versions, newest first, with the time and the author already written for the reader, and keeps which one is shown: onpreview asks to show a version, and the application passes its id back in current. Restoring is the application's too; confirm it first if it cannot be undone.

Props ​

PropDefaultDescription
versionsrequiredThe versions, newest first, VersionEntry[]
currentThe id of the version shown
onpreviewCalled with the id of the version that is pressed
onrestoreCalled with the id of the past version shown
titleversions messageThe title in the head
emptynoVersions messageWhat shows when there is no version
oncloseShows a close button in the head
sidepanelThe width, as Panel's side

A VersionEntry is { id, label, when, by }, all strings.

Contract ​

A Panel with a Toolbar as its head and a List of two-line items: the name, then when and by whom, one line each with an ellipsis. The current version is selected. The first version is the latest; while another one is current, a Footer holds two actions, back to the latest (the backToLatest message; it calls onpreview with the latest id) and restore (the restore message, the primary action).

Example ​

VersionsPanel

Released under the Apache-2.0 license.