Skip to content

    Browse components

    Alert Dialog

    Confirmation modal on the native <dialog> with a springy scale-in, focus starting on Cancel, async confirm with spinner and destructive styling.

    Open
    Customize

    Installation

    npx shadcn@latest add @glint-ui/alert-dialog

    First time using @glint-ui? Add the registry to components.json once, or install by URL: npx shadcn@latest add https://glintui.vercel.app/r/alert-dialog.json

    Usage

    import { AlertDialog } from "@/components/ui/alert-dialog";
    
    <AlertDialog
      trigger="Delete project"
      title="Delete this project?"
      description="This cannot be undone."
      confirmLabel="Delete"
      destructive
      onConfirm={() => deleteProject(id)}
    />

    Props

    PropTypeDefaultDescription
    titlestring"Delete this project?"Dialog heading.
    descriptionstring"This permanently removes Acme Web, its 214 deployments and all environment variables. This cannot be undone."Supporting text.
    triggerstring"Delete project"Label of the built-in trigger button. Omit to control via open.
    confirmLabelstring"Continue"Confirm button label.
    cancelLabelstring"Cancel"Cancel button label.
    destructivebooleanfalseRed confirm button and warning icon.
    onConfirmReactNode—Called on confirm. Return a promise to show a spinner until it settles.
    onCancelReactNode—Called on cancel or Escape.
    openReactNode—Controlled open state (with onOpenChange).
    position"fixed" | "absolute""fixed"fixed = true modal; absolute = contained in the nearest positioned parent.
    classNamestring—Extra classes for the root element.