Skip to content
Calm motion: animations on this site only fade, with no movement

Version history ​

Saved versions with the author and the time, and a restore button

Lists the saved versions of a document, newest first. The reader can look at an old version and bring it back. To see the changes line by line, use the diff beside it.

Basic

Looking at: v5

  • versions is a list of versions, newest first. Each version has an id, an author, and a time as text. It can also have a label, an avatar, a summary, and the counts added and removed.
  • The first version is the current one and has a "Current" tag. The other versions have a restore button that emits restore with the id.
  • v-model:selected is the id of the version that the reader looks at. A click on a version sets it. With no value, the current version is the selected one.
  • The counts show as "+12 −3". Screen readers hear them in words, such as "12 added, 3 removed".
  • Change the words with labels or a label pack: title, current, restore, and changes (a function of the two counts).

Usage ​

ts
import { BlessVersionHistory } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
versions*BlessVersion[]—newest first; the first is the current version
labelsPartial<{ title: string; current: string; restore: string; changes: (added: number, removed: number) => string; }>—
selectedstring—the id of the version the reader looks at

Events

NamePayloadDescription
update:selected[value: string | undefined]
restore[id: string]

Released under the MIT License. Character names and artwork belong to their owners.