Componentes

Alert Dialog

Confirmar ações destrutivas ou irreversíveis.

Sobreposições e menus

Carregando demonstração…

Código da demo
"use client";

import {
  AlertDialog,
  AlertDialogAction,
  AlertDialogCancel,
  AlertDialogContent,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogTitle,
  AlertDialogTrigger,
} from "@/components/ui/alert-dialog";
import { Button } from "@/components/ui/button";

export function Demo() {
  return (
    <AlertDialog>
      <AlertDialogTrigger asChild>
        <Button variant="destructive">Excluir item</Button>
      </AlertDialogTrigger>
      <AlertDialogContent>
        <AlertDialogHeader>
          <AlertDialogTitle>Confirmar exclusão?</AlertDialogTitle>
          <AlertDialogDescription>
            Esta ação não pode ser desfeita. O item será removido permanentemente.
          </AlertDialogDescription>
        </AlertDialogHeader>
        <AlertDialogFooter>
          <AlertDialogCancel>Cancelar</AlertDialogCancel>
          <AlertDialogAction>Excluir</AlertDialogAction>
        </AlertDialogFooter>
      </AlertDialogContent>
    </AlertDialog>
  );
}

Use

  • Confirmar ação destrutiva ou irreversível, com o verbo no botão.
  • Cancelar como saída segura, em foco por padrão.

Não use

  • Não use para aviso sem decisão: use Alert ou Sonner.
  • Não use para formulário: use Dialog.
Acessibilidade
Foco preso no diálogo; Esc cancela; ações claras Cancelar/Confirmar.
Importar
import { AlertDialog, AlertDialogTrigger, AlertDialogContent } from "@financeequity/ui/alert-dialog"

Neste repositório:

import { AlertDialog, AlertDialogTrigger, AlertDialogContent } from "@/components/ui/alert-dialog"
Dependências
radix-ui