Appearance
History diff
Two versions of a record side by side, read-only, with what changed between them marked in red and green.
history-historycomparison--defaultOpen in Storybook ↗When to use
- Checking what changed on a record, and who changed it: open the history page with View history in the page header.
- Comparing any two saved versions, including the current one.
When not to use
- Editing or restoring a value: the diff is read-only. Edit the record itself, in its field rows.
- Unsaved changes in an open form: the history only holds saved versions.
Anatomy
- Entry point: a secondary, small button View history with a history icon in the page header. It shows when the client turns it on.
- Two columns, one per version, each with a header that stays on top while you scroll:
- a dropdown to pick the version. Each option reads Version {n} ({date}), followed by · {author} when known. Only the left dropdown offers Current version (Version {n});
- Edited by {author} on {date} under it, in
--text-label,--color-text-muted.
- The record's panels, read-only, in the same order on both sides, so the same field sits at the same height. The id field and fields configured as hidden in history are left out.
- Diff marks on what changed:
- A changed field value becomes a chip: red on the older version, green on the newer. Unchanged values stay plain text.
- Relations are chips: added in
--color-diff-newon--color-diff-new-bg, removed in--color-diff-oldon--color-diff-old-bg, unchanged in the neutral chip colours. Each column shows only its own side: the newer version shows what was added, the older one what was removed. - A changed rich-text field gets a
--color-diff-new-borderborder on--color-diff-new-bgon the newer side, and the-oldpair on the older side.
history-relationdifflist--statesOpen in Storybook ↗Red and green follow the dates, not the columns: whichever version is older is red, wherever you put it. By default the current version is on the left and the version before it on the right.
Variants
| Change | Older version | Newer version |
|---|---|---|
| Field value | value as a red chip | value as a green chip |
| Relation added | — | green chip |
| Relation removed | red chip | — |
| Related record renamed | red chip with the old name · renamed | green chip with the new name · renamed |
| Rich text | red border and tint | green border and tint |
| Unchanged | plain value, neutral chips, default border | the same |
The chip colours of changed field values come from the client's pill configuration (modified for the older value, added for the newer).
Repeated groups of fields are compared entry by entry, by position: only the fields that differ in an entry are marked.
States
| State | What you see | Trigger |
|---|---|---|
| Loading | a spinner under the column header | a version is being fetched |
| Compared | both columns with diff marks | both versions loaded |
| No history | This item has no history yet. in the right column | no saved versions exist for the record |
| No earlier version | There are no earlier versions yet. in the right column | the record has only its current version |
| Version failed | This version could not be loaded. in that column | fetching one version fails |
| History failed | The history could not be loaded. Please try again later. above both columns | fetching the version list fails |
history-historycomparison--statesOpen in Storybook ↗Messages sit in a bordered box in body text. When the client hides empty fields, a field that is empty in a version is left out of that column.
Keyboard & accessibility
| Key | On a version dropdown |
|---|---|
| Tab | moves to the dropdown |
| Enter / Space | opens it; the dropdown keys apply |
- Everything below the headers is read-only and has no controls of its own.
- An added or removed relation chip carries hidden text, added or removed, so screen readers don't rely on its colour. A renamed relation shows renamed.
- A changed field value is a chip where the unchanged value is plain text, so the change shows without colour. Which side is older is told by the dropdown and the Edited by line.
- The diff text colours are the ink variants of danger and success, which reach 4.5:1 on their tints.
Content
- Version labels count up from the oldest version: Version 1 is the first save.
- Translation keys:
history.view-history,history.current-version,history.current-version-number,history.version-label,history.version-label-undated,history.edited-by,history.added,history.removed,history.renamed,history.no-items,history.no-history,history.no-previous-versions,history.version-load-error,history.versions-load-error.
Related
Field row · Chip & badge · Dropdown · Panel & block shells · Comments