v0.3.1 StableFoundation ComponentReact 18 & 19Zero Runtime CSS

AlertDialog

Confirm a consequential action in a native modal.

Interactive preview

Archive this project?

You can restore it from your workspace archive.

Usage

import { AlertDialog } from "@devvy-ui/react";

<AlertDialog title="Archive project?" open={open} onOpenChange={setOpen} confirmLabel="Archive" onConfirm={archive} />

API reference

Native HTML attributes, className, style and a forwarded ref are supported. Component-specific props:

PropTypeDefaultDescription
confirmLabelstringrequiredExplicit action name.
onConfirm() => voidrequiredApplication action.
pendingbooleanfalseDisables confirmation/cancel actions.
Dialog propsDialogPropsrequiredTitle, visibility and focus behavior.

Accessibility & behavior

Platform Behavior & Guidelines

Uses existing Dialog focus and fallback behavior, with an alertdialog role, explicit cancel and confirmation actions. The application owns pending state and closes on successful completion.

Source ownership

Run npx @devvy-ui/cli init once in your React project, then add the source:

npx @devvy-ui/cli add alert-dialog

Make the source yours.

Start from the canonical implementation used by the package and registry. Change the code, keep the MIT notice, and build the behavior your project needs.

AlertDialog.tsxREACT / TSX

Edit your own copy. Downloaded source uses your changes; the component preview above uses the shipped version. Run the source installer first to include shared helpers.