Alert Dialog

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

Are you absolutely sure?

This action cannot be undone. This will permanently delete your account from our servers.

Basic

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

Are you absolutely sure?

This action cannot be undone. This will permanently delete your account and remove your data from our servers.

Small

Use the size prop to make the alert dialog smaller.

Allow accessory to connect?

Do you want to allow the USB accessory to connect to this device?

Media

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

Share this project?

Anyone with the link will be able to view and edit this project.

Small with Media

Use the size 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.

Allow accessory to connect?

Do you want to allow the USB accessory to connect to this device?

Destructive

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

Delete chat?

This will permanently delete this chat conversation. View Settings

Anatomy

Import all parts and piece them together.

use leptos::prelude::*;
use singlestage::*;

#[component]
pub fn AlertDialogAnatomy -> impl IntoView {
    view!{
        <AlertDialog>
            <AlertDialogTrigger>
                <Button />
            </AlertDialogTrigger>
            <AlertDialogContent>
                <AlertDialogHeader>
                    <AlertDialogMedia />
                    <AlertDialogTitle />
                    <AlertDialogDescription />
                </AlertDialogHeader>
                <AlertDialogFooter>
                    <AlertDialogCancel />
                    <AlertDialogAction />
                </AlertDialogFooter>
            </AlertDialogContent>
        </AlertDialog>
    }
}

API Reference

AlertDialog

Contains all the parts of a Dialog component.

Custom Attributes
NameTypeDefaultDescription
openboolfalse

Reactive signal that can remotely control the open state of the popover **but is not coupled to the actual open state of the popover**

Implements global and dialog attributes.

AlertDialogAction

Wraps a button that the user presses to acknowledge the dialog.

Implements global attributes.

AlertDialogCancel

Wraps a button that the user presses to dismiss the dialog.

Implements global attributes.

AlertDialogContent

Contains content to be rendered in the main body of the dialog.

Custom Attributes
NameTypeDefaultDescription
close_buttonboolfalse

Toggles whether or not a close button should appear in the top right corner of the dialog.

sizeString""

Set the size of dialog to render.

Implements global attributes.

AlertDialogDescription

A short description/subheading describing dialog content.

Implements global attributes.

AlertDialogFooter

Displays at the bottom of the dialog, contains calls to action.

Implements global attributes.

AlertDialogHeader

Contains the dialog title and a description to be rendered in the open dialog.

Implements global attributes.

AlertDialogMedia

Contains a media element such as an icon or image to render in the header of the dialog.

Custom Attributes
NameTypeDefaultDescription
variantString""

Set the style variant of the media element. Accepted values: "destructive".

Implements global attributes.

AlertDialogTitle

A title describing dialog content.

Implements global attributes.

AlertDialogTrigger

Used to wrap other elements and trigger the dialog on click.

Note: the slot attribute is required.