shadcn.io is not affiliated with official shadcn/ui
Sync Conflict Error Block for React
A panel for two people who changed the same document: ruled rows for the fields that differ, each with Yours and Theirs as native radio cells, a Keep all toggle, a merged result that rebuilds as you choose, and the unchanged fields in a collapsible.
Installation
Overview
Let people merge field by field instead of picking a whole file, with this sync conflict panel for React with Base UI. It's the panel Scribbleset, a shared-docs app, shows when two people changed the same brief: a compact header over one framed panel on plus-marked corners made with Guides. A Toggle Group says "Keep all mine" or "Keep all theirs" for every field at once. Under it, the three fields that differ (Target audience, Duration, Channel) are ruled rows, each with two native radio cells, Yours and Theirs, side by side on wide screens and stacked on a phone; nothing is chosen at first. A merged result rebuilds as you choose, with each field's text and where it came from, and the Shine Button "Apply merge" names the fields you still have to choose, or says it merged in this demo. The four fields that did not change sit in a Collapsible under the foot. It's built from Toggle Group, Collapsible, Shine Button, Button and Guides, with a CSS entrance only. For any editor where two people can change the same record.
FAQ
What does Apply merge do?
Nothing is synced. With fields still to choose it says which ones ("Choose for Duration and Channel.") and moves focus to the first one's Yours cell, so the first press is never a dead end. With every field chosen it waits a moment and says in a polite status line that it merged in this demo. In your app, send the merged values from the submit handler and show your server's answer in the same line.
How does it know which fields differ?
Each field is typed once with what you wrote and what the other editor wrote, and the page compares the two texts: the fields whose texts differ become the ruled rows, the rest go in the collapsible. Edit a field's text and it moves between the two lists by itself, and the counts, the merged result and the "Plus 4 fields" line follow.
How do the Keep all buttons work with the radios?
They are two ends of the same state. Pressing one chooses that side for every row; choosing the radios by hand to the same side lights the same button, and any mix leaves both off. Pressing the lit button again clears every choice. The merged result and the count move with it.
Why radio cells and not two file cards?
A conflict on one document is rarely all or nothing. Per field the choice is one of two texts, so each row is a native radio group with a name and a label, keyboard and screen reader ready, and you can see the two texts next to each other with their save times. The merged result then shows what you would end up with before anything is applied.
Related
- Pro
Import Failed Error
Files and dataA panel for a CSV import that skipped rows: a strip of counts that follow the page, a table of the first five errors each with a suggested fix and an Apply fix button, a Shine Button that follows the count, and a real CSV error report.
- Pro
Form Validation Error
Files and dataA panel for a request sent with problems: a table of what was found in two groups, must fix and check this, each row with what was typed, the rule and one fix control, and a Shine Button that warns once.
- Pro
Version Mismatch Ruler Error
MaintenanceA full-height page for a web app tab running a retired version: a ruler of five releases with the supported range shaded and You are here marked, a radio group to read each release, three changes in 5.0 and a reload button.
- Pro
Export Failed Error
Files and dataA full-screen page for an export that hit its file-size limit: the share written worked out from typed numbers, a real partial CSV with quoting and a formula guard, and a plan that splits the rest by year, quarter or month into files under the limit.
- Pro
Notification Preferences Settings
NotificationsA notification settings panel: a channel strip with all-or-nothing checkboxes, a matrix of switches by activity and channel with a locked security email, quiet hours, and a save bar that counts unsaved changes.
- Pro
Read-Only Document Error
Locked and removedA full-screen read-only page for a document editor: a drawn page with a lock above a table of six actions (allowed or not, and the role each needs), Request edit access that opens a message to the owner in place, and Open in read mode.