Archive or Delete

Archive or Delete is a copy-paste React component that stops deleted forever instead of archived 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/archive-or-delete
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

StopsDeleted forever instead of archived

Was this component page useful?

How do I install Archive or Delete?

pnpm dlx shadcn@latest add @bollard/archive-or-delete

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

How do I use Archive or Delete in React?

archive-or-delete-usage.tsx
import { ArchiveOrDelete, type RemovalChoice, type RemovalItem } from "@/components/ui/archive-or-delete"

<ArchiveOrDelete
  key={run}
  name="#launch-2025"
  items={ITEMS}
  archiveSummary="Reversible. Unarchive anytime from Settings."
  deleteSummary="Permanent. Nobody can undo this, including support."
  onConfirm={(choice) => new Promise<void>((resolve) => setTimeout(() => {
    setDone(choice)
    resolve()
  }, 600))}
  onCancel={() => setRun((n) => n + 1)}
/>

What input mistakes does Archive or Delete catch?

  • Choosing permanent deletion when archiving would do
  • Hidden differences between the two choices, by listing only the items whose fate differs first
  • Ambiguous confirm buttons, by naming the choice and the thing ("Delete forever")

What props does Archive or Delete accept?

ArchiveOrDelete props
PropTypeDefault
name* (required)

Name of the thing being removed, e.g. "#launch-2025".

string—
items* (required)

Everything affected, each with its fate under both choices.

RemovalItem[]—
onConfirm* (required)

Runs with the chosen option. Return a promise to show a pending state; a rejection is caught.

(choice: RemovalChoice) => void | Promise<void>—
onCancel

Called when the user cancels.

() => void—
value

Controlled choice. Defaults to "archive", the reversible one.

RemovalChoice—
defaultValue

Initially selected choice when uncontrolled. Defaults to archive.

RemovalChoice"archive"
onValueChange

Called when the selected choice changes.

(choice: RemovalChoice) => void—
autoFocus

Focus the reversible choice on mount, so Enter archives rather than deletes.

booleantrue
title

Dialog title; receives the thing's name.

(name: string) => React.ReactNode(n) => `Remove ${n}?`
archiveLabel

Label of the Archive option.

string"Archive"
archiveSummary

One line on how to undo an archive, e.g. "Unarchive anytime from Settings".

string"Reversible. Unarchive anytime."
deleteLabel

Label of the Delete option.

string"Delete"
deleteSummary

One honest line on recovery, e.g. "Can't be undone" or "Recoverable for 30 days".

string"Permanent. This can't be undone."
confirmArchiveLabel

Confirm button text when Archive is chosen.

(name: string) => string(n) => `Archive ${n}`
confirmDeleteLabel

Confirm button text when Delete is chosen.

(name: string) => string(n) => `Delete ${n} forever`
pendingLabel

Confirm button text while onConfirm is running.

string"Working…"
cancelLabel

Cancel button text.

string"Cancel"
sameLabel

Label above the items both choices treat the same way.

string"Same either way"

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

How is Archive or Delete accessible?

  • Choices are a role="radiogroup" labelled by the title, each option described by its summary
  • Archive is focused on open (autoFocus, default true)
  • The confirm button sets aria-busy while pending
  • The Delete highlight animation is skipped with prefers-reduced-motion; fates are written in text, not just colour

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: Authorise the delete on the server and, where possible, keep a recovery window; the dialog does not make deletion reversible.

  • Only describes the fates you pass in; it does not know what your backend really deletes
  • It does not archive or delete anything; onConfirm does

What expensive mistakes does Archive or Delete stop?

Deleted forever instead of archived

Also known as

archive · delete forever · soft delete · inbox · project archive · hide · remove

What dependencies does Archive or Delete require?

Archive or Delete facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameArchive or Delete
Registry identifier@bollard/archive-or-delete
Install commandnpx shadcn@latest add @bollard/archive-or-delete
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 Archive or Delete

How does Archive or Delete protect destructive mutations?

Archive or Delete prevents deleted forever instead of archived. Enforces deliberate friction against Choosing permanent deletion when archiving would do, Hidden differences between the two choices, by listing only the items whose fate differs first, Ambiguous confirm buttons, by naming the choice and the thing ("Delete forever"). Limitation: authorize archive-or-delete mutations on the server.

How do I install archive-or-delete with shadcn?

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

What props customize Archive or Delete?

Archive or Delete accepts `name`, `items`, `onConfirm`, `onCancel`, `value`. Configures archive, delete forever, soft delete behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of archive-or-delete?

Only describes the fates you pass in; it does not know what your backend really deletes. It does not archive or delete anything; onConfirm does Server requirement: Authorise the delete on the server and, where possible, keep a recovery window; the dialog does not make deletion reversible.

How does Archive or Delete meet accessibility guidelines?

Choices are a role="radiogroup" labelled by the title, each option described by its summary. Archive is focused on open (autoFocus, default true). The confirm button sets aria-busy while pending. The Delete highlight animation is skipped with prefers-reduced-motion; fates are written in text, not just colour. Minimizes errors: clicked delete instead of archive, meant to archive.

Which components pair with Archive or Delete?