Impact Preview

Impact Preview is a copy-paste React component that stops helps prevent a cascade delete wiping child records 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/impact-preview
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

StopsHelps prevent a cascade delete wiping child records

Was this component page useful?

How do I install Impact Preview?

pnpm dlx shadcn@latest add @bollard/impact-preview

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

How do I use Impact Preview in React?

impact-preview-usage.tsx
import { ImpactPreview, type ImpactGroup } from "@/components/ui/impact-preview"

<ImpactPreview
  key={run}
  name="Acme"
  load={async (signal) => {
    await wait(900, signal)
    if (failNext) throw new Error("Network error")
    return ACME
  }}
  onConfirm={() =>
    new Promise<void>((resolve) =>
      setTimeout(() => {
        setDeleted(true)
        resolve()
      }, 700),
    )
  }
  onCancel={() => setRun((n) => n + 1)}
/>

What input mistakes does Impact Preview catch?

  • Child records a cascade will delete
  • Records that will be detached rather than deleted
  • Confirming before the impact has loaded: Confirm stays locked
  • Load failures, with a retry

What props does Impact Preview accept?

ImpactPreview props
PropTypeDefault
name* (required)

Name of the thing being deleted, e.g. "Acme".

string—
load* (required)

Fetches the dependents. Receives an AbortSignal that fires on unmount or retry.

(signal: AbortSignal) => Promise<ImpactGroup[]>—
onConfirm* (required)

Runs when the user confirms. Return a promise to show a pending state; a rejection is caught.

() => void | Promise<void>—
onCancel

Called when the user cancels.

() => void—
title

Heading, given the parent's name.

(name: string) => React.ReactNode(n) => `Delete “${n}”?`
confirmLabel

Confirm label, given the parent's name and how many dependents get deleted with it.

(name: string, deletedCount: number) => React.ReactNode(n, count) => count > 0 ? `Delete ${n} and ${count} ${cou…
pendingLabel

Confirm button content while onConfirm is pending.

React.ReactNode"Deleting…"
cancelLabel

Cancel button content.

React.ReactNode"Cancel"
retryLabel

Retry button content after a load error.

React.ReactNode"Retry"
loadingMessage

Shown while dependents load.

(name: string) => React.ReactNode(n) => `Checking what depends on ${n}…`
errorMessage

Shown when the lookup fails. Deleting stays blocked until a retry succeeds.

(name: string) => React.ReactNode(n) => `Couldn’t check what depends on ${n}. Deleting is …

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

How is Impact Preview accessible?

  • Dialog content labelled by its title and aria-busy while loading
  • Loading text in a polite live region; errors use role=alert
  • Groups expand with aria-expanded and aria-controls
  • Locked Confirm uses aria-disabled so it stays focusable

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

What are the limitations and server boundaries?

This is a UX guard rail. Enforce on the server: Run the delete in a transaction with the same cascade rules and authorization on the server.

  • Accurate only if your load function mirrors the real cascade rules
  • The list can be stale if data changes between preview and delete
  • Not authorization; it doesn't decide who may delete

What expensive mistakes does Impact Preview stop?

Helps prevent a cascade delete wiping child records

Also known as

cascade delete · delete preview · related records · dependencies · foreign key · delete folder · delete workspace

What dependencies does Impact Preview require?

Impact Preview facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameImpact Preview
Registry identifier@bollard/impact-preview
Install commandnpx shadcn@latest add @bollard/impact-preview
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 Impact Preview

How does Impact Preview protect destructive mutations?

Impact Preview prevents a cascade delete wiping child records. Enforces deliberate friction against Child records a cascade will delete, Records that will be detached rather than deleted, Confirming before the impact has loaded: Confirm stays locked, Load failures, with a retry. Limitation: authorize impact-preview mutations on the server.

How do I install impact-preview with shadcn?

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

What props customize Impact Preview?

Impact Preview accepts `name`, `load`, `onConfirm`, `onCancel`, `title`. Configures cascade delete, delete preview, related records behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of impact-preview?

Accurate only if your load function mirrors the real cascade rules. The list can be stale if data changes between preview and delete. Not authorization; it doesn't decide who may delete Server requirement: Run the delete in a transaction with the same cascade rules and authorization on the server.

How does Impact Preview meet accessibility guidelines?

Dialog content labelled by its title and aria-busy while loading. Loading text in a polite live region; errors use role=alert. Groups expand with aria-expanded and aria-controls. Locked Confirm uses aria-disabled so it stays focusable. Minimizes errors: deleted project lost all tasks, cascade delete surprise.

Which components pair with Impact Preview?