Danger Zone

Danger Zone is a copy-paste React component that stops stray click deleted from settings 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/danger-zone
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

StopsStray click deleted from settings

Was this component page useful?

How do I install Danger Zone?

pnpm dlx shadcn@latest add @bollard/danger-zone

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

How do I use Danger Zone in React?

danger-zone-usage.tsx
import { DangerZone, DangerZoneAction } from "@/components/ui/danger-zone"

<DangerZoneAction
  title="Transfer ownership"
  consequence="Moves acme-web to another team. You lose admin access."
  actionLabel="Transfer"
  onAction={() => setLog("Transfer started. The zone locked again.")}
/>

What input mistakes does Danger Zone catch?

  • Stray clicks on destructive actions while the section is locked
  • An unlocked section left open (idle timeout, tab hidden, focus leaving)
  • Chained destructive actions, by relocking after each one

What props does Danger Zone accept?

DangerZone props
PropTypeDefault
title

Heading of the section.

React.ReactNode"Danger zone"
timeout

Seconds of inactivity before it locks again. Any interaction inside restarts the count.

number60
lockAfterAction

Lock again as soon as one action has run, so one unlock can't be spent on several.

booleantrue
unlocked

Controlled lock state.

boolean—
defaultUnlocked

Initial unlocked state when uncontrolled.

booleanfalse
onUnlockedChange

Called when the section locks or unlocks.

(unlocked: boolean) => void—
unlockLabel

Text for the unlock button.

string"Unlock"
lockLabel

Text for the lock button.

string"Lock"
lockedText

Shown while locked. `{count}` is the number of actions inside.

string"{count} destructive actions are locked."
unlockedText

Shown while unlocked. `{seconds}` counts down to the auto-lock.

string"Unlocked. Locks again in {seconds}s or when you leave th…
nudgeText

Shown for a moment when a locked action is pressed.

string"Locked, so nothing happened. Unlock first if you meant it."

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

How is Danger Zone accessible?

  • Section labelled by its title; the unlock toggle uses aria-pressed
  • Locked actions use aria-disabled so they stay focusable and are described by their consequence
  • Escape relocks; lock state changes are aria-live="polite"
  • Actions set aria-busy while pending

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 every destructive action on the server and require re-authentication where it matters; the lock is a UI guard.

  • Unlocking is a deliberate click, not authentication; pair it with re-auth or typed confirmation for serious actions
  • It does not perform or confirm the action itself

What expensive mistakes does Danger Zone stop?

Stray click deleted from settings

Also known as

danger zone · settings page · delete account · delete project · transfer ownership · github settings · admin settings

What dependencies does Danger Zone require?

Danger Zone facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameDanger Zone
Registry identifier@bollard/danger-zone
Install commandnpx shadcn@latest add @bollard/danger-zone
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 Danger Zone

How does Danger Zone protect destructive mutations?

Danger Zone prevents stray click deleted from settings. Enforces deliberate friction against Stray clicks on destructive actions while the section is locked, An unlocked section left open (idle timeout, tab hidden, focus leaving), Chained destructive actions, by relocking after each one. Limitation: authorize danger-zone mutations on the server.

How do I install danger-zone with shadcn?

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

What props customize Danger Zone?

Danger Zone accepts `title`, `timeout`, `lockAfterAction`, `unlocked`, `defaultUnlocked`. Configures danger zone, settings page, delete account behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of danger-zone?

Unlocking is a deliberate click, not authentication; pair it with re-auth or typed confirmation for serious actions. It does not perform or confirm the action itself Server requirement: Authorise every destructive action on the server and require re-authentication where it matters; the lock is a UI guard.

How does Danger Zone meet accessibility guidelines?

Section labelled by its title; the unlock toggle uses aria-pressed. Locked actions use aria-disabled so they stay focusable and are described by their consequence. Escape relocks; lock state changes are aria-live="polite". Actions set aria-busy while pending. Minimizes errors: delete button in settings clicked by mistake, settings danger zone.

Which components pair with Danger Zone?