AlertDialog

Modal confirmation dialog built on Radix UI. Blocks interaction until the user responds. Supports a destructive action variant.

Live Demo

Props

PropTypeDefaultDescription
AlertDialogRadix RootRoot component that controls open/closed state.
AlertDialogTriggerRadix TriggerElement that opens the dialog.
AlertDialogContentRadix ContentThe modal panel with overlay.
AlertDialogTitleRadix TitleAccessible title of the dialog.
AlertDialogDescriptionRadix DescriptionAccessible description of the dialog.
AlertDialogActionRadix ActionConfirm/proceed button. Closes the dialog.
AlertDialogCancelRadix CancelCancel button. Closes the dialog without action.
variant (Action)'default' | 'destructive''default'Action button variant: default or destructive.

Usage

import {
  AlertDialog, AlertDialogTrigger, AlertDialogContent,
  AlertDialogHeader, AlertDialogFooter,
  AlertDialogTitle, AlertDialogDescription,
  AlertDialogAction, AlertDialogCancel,
} from '@ghiberti85/ui'

// Default
<AlertDialog>
  <AlertDialogTrigger asChild>
    <Button>Open</Button>
  </AlertDialogTrigger>
  <AlertDialogContent>
    <AlertDialogHeader>
      <AlertDialogTitle>Are you sure?</AlertDialogTitle>
      <AlertDialogDescription>This action cannot be undone.</AlertDialogDescription>
    </AlertDialogHeader>
    <AlertDialogFooter>
      <AlertDialogCancel>Cancel</AlertDialogCancel>
      <AlertDialogAction>Continue</AlertDialogAction>
    </AlertDialogFooter>
  </AlertDialogContent>
</AlertDialog>

// Destructive variant
<AlertDialogAction variant="destructive">Delete</AlertDialogAction>

View in Storybook

Open in Storybook
Ghiberti UI — Design System