Version Scrubber

Version Scrubber is a copy-paste React component that stops restored wrong version of document before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/version-scrubber
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsRestored wrong version of document

Was this component page useful?

How do I install Version Scrubber?

pnpm dlx shadcn@latest add @bollard/version-scrubber

The files land in your project. They're yours to edit.

How do I use Version Scrubber in React?

version-scrubber-usage.tsx
import { VersionScrubber, type Version } from "@/components/ui/version-scrubber"

return <VersionScrubber versions={versions} currentId={current.id} defaultSelectedId="b" onRestore={restore} className="max-w-md" />

What input mistakes does Version Scrubber catch?

  • What a restore would change, as a word diff
  • Changed numbers, called out
  • Words lost and gained, counted in the confirmation
  • Selecting the current or an identical version (nothing to restore)
  • Restore failures, with the current version kept

What props does Version Scrubber accept?

VersionScrubber props
PropTypeDefault
versions* (required)

Saved versions, oldest first.

Version[]—
currentId

The version that is live now. Defaults to the newest.

stringversions[versions.length - 1]?.id
selectedId

Controlled selected version.

string—
defaultSelectedId

Initially selected version when uncontrolled. Defaults to the current one.

string—
onSelectedIdChange

Called when the user scrubs to another version.

(id: string) => void—
onRestore* (required)

Make this version current. Return a promise to show progress; a rejection shows `errorText`.

(version: Version) => void | Promise<void>—
formatTime

Formats save times. Runs after mount, so server and client agree.

(date: Date) => stringdefaultFormat
confirmText

Restore confirmation. `{name}`, `{when}`, `{removed}`, `{added}` are filled in.

string"Restoring {name} from {when} removes {removed} and bring…
numbersText

Added to the confirmation when numbers differ; `{numbers}` is "14 → 30".

string"Numbers change: {numbers}."
keptText

Reassurance that restoring is not destructive.

string"The current text stays in the history."
heading

Other visible text and button labels.

string"Version history"
currentLabel

Badge for the current version.

string"Current"
backLabel

Label of the back-to-current button.

string"Back to current"
restoreLabel

Label of the Restore button.

string"Restore this version…"
confirmLabel

Label of the confirm-restore button.

string"Restore {name}"
cancelLabel

Label of the Cancel button.

string"Cancel"
isCurrentText

Shown when the selected version is current.

string"This is the current version."
identicalText

Shown when the selected version matches the current one.

string"Same text as the current version."
errorText

Shown when onRestore rejects.

string"Couldn't restore. Nothing was changed."

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

How is Version Scrubber accessible?

  • Timeline slider is labelled with aria-valuetext naming the version
  • Diff parts have sr-only "comes back" / "removed" prefixes
  • Confirm is a labelled group; Cancel gets focus; Escape closes
  • Errors use role=alert; summary in a polite live region

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Word-level diff, not semantic
  • Restore runs through your onRestore

What expensive mistakes does Version Scrubber stop?

Restored wrong version of document

Also known as

version history · restore version · diff · timeline · google docs history · revisions · time travel

Field type

What dependencies does Version Scrubber require?

Version Scrubber facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameVersion Scrubber
Registry identifier@bollard/version-scrubber
Install commandnpx shadcn@latest add @bollard/version-scrubber
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Version Scrubber

What form validation mistake does Version Scrubber catch?

Version Scrubber prevents restored wrong version of document. Lets people scrub through saved versions and see exactly what a restore would change before confirming it. Catches: What a restore would change, as a word diff, Changed numbers, called out, Words lost and gained, counted in the confirmation, Selecting the current or an identical version (nothing to restore), Restore failures, with the current version kept. Limitation: validate version-scrubber schemas on backend.

How do I install version-scrubber with shadcn?

Run `npx shadcn@latest add @bollard/version-scrubber`. Sources added: registry/default/version-scrubber/version-scrubber.tsx. Package requirements: lucide-react.

What props customize Version Scrubber?

Version Scrubber accepts `versions`, `currentId`, `selectedId`, `defaultSelectedId`, `onSelectedIdChange`. Configures version history, restore version, diff behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of version-scrubber?

Word-level diff, not semantic. Restore runs through your onRestore Server requirement: backend verification for version-scrubber.

How does Version Scrubber meet accessibility guidelines?

Timeline slider is labelled with aria-valuetext naming the version. Diff parts have sr-only "comes back" / "removed" prefixes. Confirm is a labelled group; Cancel gets focus; Escape closes. Errors use role=alert; summary in a polite live region. Minimizes errors: restored wrong version, version history lost words.

Which components pair with Version Scrubber?