All components (244)
Change history
Management · AuditLogViewer
What it is and when to use it
The change history of something: who did what, on what and when, with what changed field by field and, if the application allows it, a button to revert with its confirmation.
When to use it
- The history tab of a record: an invoice, a customer, a user.
- Each entry carries
actor,at,actionand, optionally,targetandchanges. Each change is shown withDiffViewer. searchableadds a field to search by person, action, object or field;onLoadMoreasks for more entries in batches.- Entries are grouped by day (
groupByDay) in the browser's time zone or in that oftimeZone. The order is the one they arrive in. - With
onRevert, each entry carries a button with confirmation;revertible: falseremoves it from one entry.
When not to
- Notifications or alerts about what is happening now: the notification tray.
- Reverting is not done by the library: your function does it, and the server has to check again that it can be done.
Keyboard: each entry unfolds with Enter or Space on its summary; the search and the buttons are normal controls.
Accessibility: the list is a named group (label, required), the days are headings and each time carries its full date. While loading, the list is marked as busy.
Fine appearance: the boxes use the library's surface and border tokens; the diff of each field, the --amset-diff-* variables.
What it looks like
Friday, October 30, 2026
Marta Ruiz changed the price of Anillo Aurelia
View 1 change
- Price
Line removed: 89 Line added: 95
- Price
Aitor Mena archived the order #1042
View 1 change
- Status
Line removed: enviado Line added: archived
- Status
Thursday, October 29, 2026
Carla Gil registered Lucía Ferrer
View 2 changes
- Role
Line added: gestor - Active
Line added: true
- Role
Press “Revert” on the price change.
<AuditLogViewer
label="Change log"
entries={entradas}
timeZone="Europe/Madrid"
searchable
defaultExpanded
onRevert={(entrada) => deshacer(entrada)}
/>Props
Import it with import { AuditLogViewer } from '@amset/ui'. Required props are marked.
| Prop | Type | What it does |
|---|---|---|
entriesrequired | readonly AuditEntry[] | — |
labelrequired | string | Which history it is («History of invoice 2026-0142»): it names the list. Required. |
className | string | Merged with the library classes; it does not replace them. |
dayHeadingLevel | AuditHeadingLevel | The level of each day's heading. 3 by default. |
defaultExpanded | boolean | With the entries unfolded from the start. Off by default. |
emptyText | string | What is said when there are no entries. |
groupByDay | boolean | Groups the entries under the day they happened. On by default. |
loading | boolean | The history is being requested: the wait is shown instead of «there is nothing». |
onLoadMore | () => void | Promise<void> | Ask for more entries: the load-more button appears, with the count if `total` is passed. |
onRevert | (entry: AuditEntry) => void | Promise<void> | Revert an entry. If passed, each revertible entry carries its button, with a confirmation first. If it fails (throws or rejects), the confirmation itself says so and the entry stays as it was. The library undoes nothing: this function does, and the server has to check again that it can be done. |
searchable | boolean | A field to search by who, what they did, on what or in which fields. Off by default. |
timeZone | string | The time zone in which days and times are written. The browser's by default. |
total | number | How many entries there are in total, for the button's count. |
It also accepts the attributes of the element it renders: className, style, data-*, aria-* and its events.
In the test bench
Every state and variant, to try one at a time, on its page at ui.amset.tech:
