@mks2508/mks-ui
Components

AlertDialog

Confirmation dialog requiring explicit user action before proceeding.

AlertDialog

A confirmation dialog that requires an explicit user decision. Unlike Dialog, it cannot be dismissed by clicking the overlay. Built on Base UI AlertDialog with Motion animations.

Import

import { AlertDialog, AlertDialogTrigger, AlertDialogPortal, AlertDialogBackdrop, AlertDialogPopup, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogClose } from '@mks2508/mks-ui/react';

Basic Usage

<AlertDialog>
  <AlertDialogTrigger>
    <Button variant="destructive">Delete Account</Button>
  </AlertDialogTrigger>
  <AlertDialogPortal>
    <AlertDialogBackdrop />
    <AlertDialogPopup>
      <AlertDialogHeader>
        <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
        <AlertDialogDescription>
          This action cannot be undone. This will permanently delete your account
          and remove your data from our servers.
        </AlertDialogDescription>
      </AlertDialogHeader>
      <AlertDialogFooter>
        <AlertDialogClose>
          <Button variant="outline">Cancel</Button>
        </AlertDialogClose>
        <Button variant="destructive">Yes, delete my account</Button>
      </AlertDialogFooter>
    </AlertDialogPopup>
  </AlertDialogPortal>
</AlertDialog>

Animation Direction

The AlertDialogPopup accepts a from prop to control the 3D flip animation:

<AlertDialogPopup from="top">    {/* Flips in from top */}
<AlertDialogPopup from="bottom"> {/* Flips in from bottom */}

API Reference

ComponentKey PropsDescription
AlertDialogopen, defaultOpen, onOpenChangeRoot provider
AlertDialogTriggerasChildTrigger element
AlertDialogPortalPortal with AnimatePresence
AlertDialogBackdroptransition, slotsAnimated backdrop overlay
AlertDialogPopupfrom, transition, slotsModal content with flip animation
AlertDialogHeaderslotsHeader layout
AlertDialogTitleslotsTitle text
AlertDialogDescriptionslotsDescription text
AlertDialogFooterslotsFooter with actions
AlertDialogCloseslotsClose trigger