UILab

Alert Dialog

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

"use client"

import {
  AlertDialog,
  AlertDialogAction,

Usage

import {
  Button,
  AlertDialog,
  AlertDialogAction,
  AlertDialogCancel,
  AlertDialogContent,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogTitle,
  AlertDialogTrigger,
} from "uilab-core"
<AlertDialog>
  <AlertDialogTrigger
    render={<Button variant="outline">Show Dialog</Button>}
  />
  <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>

Examples

Basic

A basic alert dialog with a title, description, and cancel and continue buttons.

"use client"

import {
  AlertDialog,
  AlertDialogAction,

Small

Use the size="sm" prop to make the alert dialog smaller.

"use client"

import {
  Button,
  AlertDialog,

Media

Use the AlertDialogMedia component to add a media element such as an icon or image to the alert dialog.

"use client"

import {
  Button,
  AlertDialog,

Small with Media

Use the size="sm" prop to make the alert dialog smaller and the AlertDialogMedia component to add a media element such as an icon or image to the alert dialog.

"use client"

import {
  Button,
  AlertDialog,

Destructive

Use the AlertDialogAction component to add a destructive action button to the alert dialog.

"use client"

import {
  Button,
  AlertDialog,

On this page