shadcn.io is not affiliated with official shadcn/ui
Editor Tracked Changes Profile Block for React
An editor profile as tracked changes: a paragraph with five edits marked by number, glyph, underline and strike, an Accept and Reject pair on each, Accept all and Reject all, and a clean copy that follows with its word count.
Installation
Overview
Show how an editor works on the text itself, with this tracked changes profile for React with Base UI. A compact header holds the title and one sentence, and the hairline frame under it opens on the editor: initials, name, role, place and her three credits as outline Badges. A sheet holds a paragraph of about seventy words with five edits marked in it: each carries a numbered tag with a glyph for an insertion, a deletion or a replacement, and a line of its own kind, an insertion underlined and a deletion struck through, so no edit depends on a colour. A list under it names each edit's kind in a word, shows what it changes and gives it a Toggle Group with Accept and Reject, which can be pressed off again; two ghost buttons, Accept all and Reject all, decide the lot. An accepted edit is applied in the text, a rejected edit is put back and one still to decide stays marked. Under the list the clean copy re-derives from the decisions with its word count counted from the text, and the foot says how many edits are accepted, rejected and still to decide. It's built from Toggle Group, Button, Badge, Avatar and Guides, with a CSS entrance only. The editor, her credits and the paragraph are invented. For an editors' network, a freelance profile or any page that shows how a text was changed.
FAQ
How do I use my own text and edits?
Edit CHUNKS (the paragraph in order, as plain text and as places where an edit sits) and EDITS (each one's kind, its number and the wording before and after; an insertion has an empty before and a deletion an empty after). The clean copy, its word count, the counts in the foot and the lists are all worked out from them, so nothing is typed twice. Keep a space inside the changed wording, as in Word, so a rejected insertion leaves no double space.
What does the clean copy show?
The paragraph as it reads with the edits you have accepted. A rejected edit is put back as it was written, and an edit still to decide also keeps its original wording until you decide, which the line under the copy says. Its word count is counted from the text, and an unseen copy of the longest version holds the panel's height, so deciding never moves the controls below.
What stays local in the demo?
All of it. The decisions live in the page and nothing is saved or sent. In your own app send each decision to the document you are editing, and treat Accept all and Reject all as one change with an undo.
Is it accessible?
Each edit says what it is three ways: its tag in the text, the line through or under the wording, and a word and a glyph in the list. The text reads "Deleted" or "Inserted" before each changed phrase for a screen reader, and each pair of buttons is a named group, Decision for edit 1, whose buttons say Accept edit 1 and Reject edit 1. Both buttons can be pressed off, which puts the edit back to still to decide. The status line is a polite live region present from the start.
Related
- Pro
Copywriter Sample Shelf Profile
Writing and wordsA copywriter profile as a shelf of four samples: an industry filter with counts over accordion rows, each closed row showing the lift it earned, each open row the brief, the headline before and after, the copy with its word count and the measured result.
- Pro
Technical Writer Documentation Types Profile
Writing and wordsA technical writer profile as four kinds of documentation page: tabs for reference, tutorial, how-to and concept, each a drawn mini page with its outline in a side cell, figures for words and reading time, and a press-to-mark part of the page.
- Pro
Journalist Beat Tree Profile
Writing and wordsA journalist profile as a beat tree: a tree of six beats, sub-beats and stories with the number of stories rolled up on every branch, and a byline card for the story you pick with its outlet, date, length, reading time and Exclusive badge.
- Pro
Author Look Inside Profile
Writing and wordsAn author profile as a look inside: four books with drawn typographic covers, a read-only rating and an award badge, and a reading pane with a drop cap, a text size group and Next and Previous between two pages, beside a Follow toggle.
- Pro
Diff Viewer Changelog
Code and commitsOne config file's diff in a framed, focusable region, with Previous change and Next change buttons that move a ring from hunk to hunk and a live count.
- Pro
Margin Note Editorial Blog
Featured storyThree editor's picks as split rows: the post with a numeral tile at the start and, in a tinted margin cell at the end, the editor's note with a hanging quote mark and a marked reason.