Activity Log
Who changed what, and when, with undo: createActivityLog records the page's UI SDK control changes (from people, agents and the app) and the app's own records, and steps back and forward through them. ActivityLog lists them newest first; pressing an entry seeks to it, Undo and Redo bind Cmd/Ctrl+Z and Shift+Cmd/Ctrl+Z outside text fields, and undoToast shows a toast with Undo. Agents call undo, redo and seek; a seek that undoes more than confirmAbove entries needs a person (data-agent-confirm).
Example
Activity
No changes yet
Installation
lucide-reactUsage
Show who changed what and when, and let people and agents step back: record the page's controls with createActivityLog, add your own changes with record, list them with ActivityLog.
API reference
ActivityLog
| Prop | Type | Default |
|---|---|---|
logrequired | ActivityLogStore | – |
labelrequiredNames the log, for screen readers and agents. | string | – |
labels | Partial<Omit<ActivityLogLabels, "actors">> & { actors?: Partial<Record<ActivityActor, string>> } | – |
headerA heading beside Undo and Redo. | ReactNode | – |
confirmAboveSeeks that undo more entries than this need a person's approval when an agent asks for them. | number | 3 |
shortcutsBinds Cmd/Ctrl+Z and Shift+Cmd/Ctrl+Z, listed in `ShortcutsDialog`. Turn off for a second log on the page. | boolean | true |
nowPass one `useNow()` per screen. | Instant | – |
locale | string | – |
Also takes ComponentProps except log, children.
Other exports
actorOfcreateActivityLogactivityLogactivityLogLabelsundoToastuseActivityLogtype ActivityActortype ActivityEntrytype ActivityLogtype ActivityLogOptionstype ActivityLogSnapshottype ActivityNotRestoredtype ActivityRecordtype ActivityLogPrimitiveOptionstype ActivityLogLabelstype ActivityLogPropstype UndoToastOptionsAccessibility
- The log is a named group; the current point in its history has aria-current="step", and undone entries say so to screen readers.
- Undo and Redo bind Cmd/Ctrl+Z and Shift+Cmd/Ctrl+Z, listed in ShortcutsDialog, and leave those keys to a focused text field.
Agent actions
Agents read the entries as items and call undo, redo and seek (by position or by an entry's sentence). A seek that undoes more than confirmAbove entries carries data-agent-confirm, so a person approves it.
Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.