Live code edit
A small code editor plays edits: a line is struck and collapses, new lines type in and flash, numbers shift.
The React code for this component comes with Pro.
Unlock with ProUse it for
- Developer tool heroes that show a change being made
- Docs or changelogs explaining a config or API change
- Showing what an AI agent or code mod edits in a file
Avoid
- Code people need to copy, use a real code block
- Large diffs, the typing gets slow past a few lines
How it works
An edit index and a phase (mark, collapse, type, rest) drive the file, which is rebuilt from the start document by applying earlier edits, so state changes only once per phase. Each row is a one track grid that collapses from 1fr to 0fr, and line numbers are counted at render so they shift as rows close and open. New lines type with a width animation in ch units using steps() in a monospace face, then flash; a CSS variable holds each line's start time so lines type one after another.
Accessibility
The code area is role img with a label naming the current edit and its new lines, and the status bar shows the edit as text. Replay is a real button. Reduced motion shows the finished file with the last edit marked, with no typing, collapsing or blinking caret.
Get the source with Pro
The demo above is free to play with. Pro unlocks the source of this and every other Pro component, with copy-ready code and a zip download.
Already bought? Sign in- Pay once
Lifetime
Pay once, keep it forever.
$39once
- Every Pro component, with full source
- Lifetime updates: every future Pro component included
- One zip download, ready to drop into a React app
- Commercial use in unlimited client and personal projects