Keyboard accessible by default with semantic markup, visible focus treatment, and tokenized states. Add descriptive labels for icon-only or decorative usage.
Dependency notes
Check Installation for shared peers. This component keeps styling in Tailwind classes and the --zui-* token contract.
Data display
Time Travel Inspector
Move through application snapshots and see exactly what changed. A synchronized scrubber, state viewer, and custom renderer keep each historical moment in context.
Provide renderPreview to display your application at this moment.
1 change
Added (1000 ms) → Discount (2000 ms)
/cart/total · changed
Before: 80
After: 64
History and rendering contract
Pass immutable snapshots in nondecreasing timestamp order with unique, nonempty IDs. The first event must be a checkpoint. Timestamps are milliseconds, including zero; formatTimestamp controls their display. Events at the same timestamp keep their supplied order.
createTimeTravelHistory(captures, checkpointInterval) stores a full checkpoint every 20 events by default and key-level deltas in between. It copies input states. For long sessions, record checkpoints and deltas directly and release the original full captures. Seeking replays only from the nearest checkpoint; nearby event buttons are limited to seven.
In Server Components or server code, import the pure helpers from @zentauri-ui/zentauri-components/ui/time-travel-inspector/history to compact or resolve history before passing snapshots to the client inspector. The UI entry also re-exports these helpers for client use. Replace snapshots and patches immutably when updating history.
State must be finite JSON data: objects, arrays, strings, numbers, booleans, and null. Dates, undefined, class instances, and cyclic objects are unsupported. Changes use object-key path arrays; arrays are replaced atomically. A set with an empty path replaces the root. Remove requires a nonempty path to an object key, and nested patch parents must already exist. Diff results are discriminated by type: added includes after, removed includes before, and changed includes both.
The state viewer, diff, and renderPreview receive the same moment. A null comparisonId follows the previous event; an explicit ID pins any baseline. selectedId, comparisonId, and bookmarks support controlled values with change callbacks. Unknown selection IDs fall back to the latest event; unknown comparison IDs fall back to the previous event. Bookmarks for absent events are hidden.
Use renderPreview for an application-specific historical view and onOpenState to open it elsewhere. Treat renderer and callback data as immutable. The component does not restore live application state or capture sessions automatically. The scrubber supports native arrow, Home, and End keys; navigation, comparison, and bookmarks also use native keyboard controls.
Time Travel Inspector API
Generated from the package prop types and variant definitions.
Import from @zentauri-ui/zentauri-components/ui/time-travel-inspector. This static entry does not require Framer Motion. With the package install, include the package in your Tailwind v4 scan scope:
Adjust the source path for your stylesheet location. Scope paired light/dark variables to a wrapper, such as --zui-time-travel-inspector-selected-bg and --zui-time-travel-inspector-selected-bg-dark.
TimeTravelInspector combines a keyboard-accessible timeline, bookmarks, timestamp comparison, state differences, and an optional custom preview.
Common use cases
Replay a checkout session to inspect when a cart total changed.
Compare editor or workflow state before and after an action.
Bookmark important events during a debugging session.
FAQ
How are snapshots stored?
Use createTimeTravelHistory to compact JSON captures into periodic checkpoints and incremental key changes, or supply checkpoints and deltas directly. Each seek starts at the nearest checkpoint.
Can I render my own historical UI?
Yes. renderPreview receives the selected state, event, comparison state, and changes. onOpenState lets your application open a historical view.
Does this record my application automatically?
No. Your application owns capture, persistence, and restoration. The inspector displays the immutable history you supply.