This page as markdown: /destructive-action-modal.md · Index for agents: /llms.txt · Everything in one file: /llms-full.txt

DestructiveActionModal

Status: stable

Confirmation modal for irreversible actions, built on AlertDialog (role=alertdialog; a backdrop click does not dismiss). Pairs a secondary Cancel with a destructive confirm; awaits an async onConfirm (spinner + stays open on failure) or takes an external pending flag; optional body slot and type-to-confirm guard for high-stakes deletions.

Keywords: destructive, modal, confirmation, danger

Usage

Use DestructiveActionModal to confirm irreversible or high-risk actions before they run.

Best practices

Props

Name Type Default Description
open boolean — Controlled open state.
onOpenChange (open: boolean) => void — Called when the open state should change (Esc, Cancel, or confirm). A backdrop click does not dismiss.
title ReactNode — Modal heading — names the irreversible action.
description ReactNode — Optional supporting copy explaining the consequence.
confirmLabel string "Delete" Label for the destructive confirm button.
cancelLabel string "Cancel" Label for the dismissing secondary button.
onConfirm () => void | Promise — Called when the user confirms. If it returns a Promise the modal shows an in-flight spinner, closes on resolve, and stays open on reject; if void it closes immediately (unless pending is controlled).
pending boolean — Externally-driven in-flight state. Overrides the internal await tracking; the parent owns closing (the modal stays open on a synchronous confirm).
confirmingLabel string confirmLabel Confirm-button label shown while the action is in flight.
children ReactNode — Body content rendered between the description and the type-to-confirm Input / footer — e.g. a warning .
confirmText string — When set, renders an Input the user must type matching to enable the destructive confirm button.

Tokens used

card, card-foreground, border, muted-foreground, foreground, input, destructive, destructive-foreground, secondary, secondary-foreground

Accessibility

Related

Examples

Basic

import { DestructiveActionModal } from "@sableui/react"

<DestructiveActionModal open={open} onOpenChange={setOpen} title='Delete post?' description='This permanently removes the post. This cannot be undone.' onConfirm={handleDelete} />

Async confirm (awaited spinner)

import { DestructiveActionModal } from "@sableui/react"

<DestructiveActionModal open={open} onOpenChange={setOpen} title='Block user?' description='They can no longer interact with you.' confirmLabel='Block' confirmingLabel='Blocking…' onConfirm={() => blockUser(id)} />

Body slot + type-to-confirm

import { DestructiveActionModal, Note } from "@sableui/react"

<DestructiveActionModal open={open} onOpenChange={setOpen} title='Delete this post?' confirmText='gold rush' confirmLabel='Delete forever' onConfirm={handleDelete}><Note tone='warning'>People you shared this post with lose access to it.</Note></DestructiveActionModal>