Formula Overwrite Guard

Formula Overwrite Guard is a copy-paste React component that stops paste wiped spreadsheet formulas 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/formula-overwrite-guard
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

StopsPaste wiped spreadsheet formulas

Was this component page useful?

How do I install Formula Overwrite Guard?

pnpm dlx shadcn@latest add @bollard/formula-overwrite-guard

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

How do I use Formula Overwrite Guard in React?

formula-overwrite-guard-usage.tsx
import { FormulaOverwriteGuard, type Grid } from "@/components/ui/formula-overwrite-guard"

return <FormulaOverwriteGuard value={sheet} onValueChange={(g) => setSheet(recalc(g))} defaultPaste={{ text: COPIED, row: 2, col: 1 }} />

What input mistakes does Formula Overwrite Guard catch?

  • Pastes that overwrite formulas
  • Locked cells and the heading row
  • Data spilling past the table edge
  • A heading row copied along with the data

What props does Formula Overwrite Guard accept?

FormulaOverwriteGuard props
PropTypeDefault
value

Controlled cells, row by row.

Grid—
defaultValue

Initial cells when uncontrolled.

Grid[]
onValueChange

Called with the new cells after a paste or undo.

(grid: Grid) => void—
headerRows

How many top rows are headings.

number1
defaultPaste

Opens with this paste under review (for restoring an unresolved paste, and for demos).

{ text: string; row: number; col: number }—
messages

Any visible string.

Partial<Omit<FormulaGuardMessages, "legend">> & { legend?: Partial<Record<CellFate, string>> }—

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

How is Formula Overwrite Guard accessible?

  • The preview is a role="region" with an aria-label summarising rows, columns and cell
  • Locked and formula cells use icons plus text
  • Actions are buttons with visible text

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

What are the limitations and server boundaries?

  • Works on the grid model you pass; it isn't connected to a spreadsheet engine
  • "Safe" paste skips cells rather than merging values

What expensive mistakes does Formula Overwrite Guard stop?

Paste wiped spreadsheet formulas

Also known as

spreadsheet · data grid · paste · excel · google sheets · formulas · paste special · ag grid

Field type

What dependencies does Formula Overwrite Guard require?

Formula Overwrite Guard facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameFormula Overwrite Guard
Registry identifier@bollard/formula-overwrite-guard
Install commandnpx shadcn@latest add @bollard/formula-overwrite-guard
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 Formula Overwrite Guard

What form validation mistake does Formula Overwrite Guard catch?

Formula Overwrite Guard prevents paste wiped spreadsheet formulas. Previews which cells a spreadsheet paste would change, so formulas, locked cells and headings aren't wiped silently. Catches: Pastes that overwrite formulas, Locked cells and the heading row, Data spilling past the table edge, A heading row copied along with the data. Limitation: validate formula-overwrite-guard schemas on backend.

How do I install formula-overwrite-guard with shadcn?

Run `npx shadcn@latest add @bollard/formula-overwrite-guard`. Sources added: registry/default/formula-overwrite-guard/formula-overwrite-guard.tsx, registry/default/formula-overwrite-guard/paste-plan.ts. Package requirements: lucide-react.

What props customize Formula Overwrite Guard?

Formula Overwrite Guard accepts `value`, `defaultValue`, `onValueChange`, `headerRows`, `defaultPaste`. Configures spreadsheet, data grid, paste behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of formula-overwrite-guard?

Works on the grid model you pass; it isn't connected to a spreadsheet engine. "Safe" paste skips cells rather than merging values Server requirement: backend verification for formula-overwrite-guard.

How does Formula Overwrite Guard meet accessibility guidelines?

The preview is a role="region" with an aria-label summarising rows, columns and cell. Locked and formula cells use icons plus text. Actions are buttons with visible text. Minimizes errors: paste overwrote formulas, paste values only.

Which components pair with Formula Overwrite Guard?