Components
Alert Dialog

Alert Dialog

A modal dialog that interrupts the user with important content and expects a response.

Usage

  • Examples include action confirmation prompts and error message confirmations.
  • Use AlertDialogTrigger as a button to turn off AlertDialog
  • You can also manage the toggle with a boolean state using props open:boolean | onOpenChange:(FC)
  • Use AlertDialogFooter to contain your event handling buttons with 2 Components AlertDialogAction and AlertDialogCancel
import {
  AlertDialog,
  AlertDialogAction,
  AlertDialogCancel,
  AlertDialogContent,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogTitle,
  AlertDialogTrigger,
} from "@momo-webplatform/mobase";
app.js
<AlertDialog>
  <AlertDialogTrigger>Open</AlertDialogTrigger>
  <AlertDialogContent>
    <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>
      <AlertDialogCancel>Cancel</AlertDialogCancel>
      <AlertDialogAction>Continue</AlertDialogAction>
    </AlertDialogFooter>
  </AlertDialogContent>
</AlertDialog>

API Reference

Alert Dialog component extends Radix Alert Dialog (opens in a new tab) component and supports all of its props.

AlertDialog
PropTypeDefaultRequired
open
enumboolean--false
defaultOpen
enumboolean--false
onOpenChange
(open: boolean) => void--false
AlertDialogTrigger
PropTypeDefaultRequired
asChild
enumboolean--false
AlertDialogPortal
PropTypeDefaultRequired
container
HTMLElement--false
forceMount
true--false
AlertDialogOverlay
PropTypeDefaultRequired
asChild
enumboolean--false
forceMount
true--false
AlertDialogContent
PropTypeDefaultRequired
asChild
enumboolean--false
forceMount
true--false
onEscapeKeyDown
(event: KeyboardEvent) => void--false
onFocusOutside
(event: FocusOutsideEvent) => void--false
onOpenAutoFocus
(event: Event) => void--false
onCloseAutoFocus
(event: Event) => void--false
AlertDialogAction
PropTypeDefaultRequired
asChild
enumboolean--false
AlertDialogCancel
PropTypeDefaultRequired
asChild
enumboolean--false
AlertDialogTitle
PropTypeDefaultRequired
asChild
enumboolean--false
AlertDialogDescription
PropTypeDefaultRequired
asChild
enumboolean--false
AlertDialogFooter
PropTypeDefaultRequired
AlertDialogHeader
PropTypeDefaultRequired