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 item and remove it from our servers.

Installation

CLI

Install the component using the StarUI CLI:

star add alert-dialog

Examples

Rich Content

Icons, consequence lists, and Card composition for a danger zone pattern

Danger Zone

Irreversible actions

Delete Repository

Once deleted, it will be gone forever

Delete Repository

This action cannot be undone. This will permanently delete the repository and all of its contents.

The following will be deleted:

  • All source code and version history
  • Issues, pull requests, and comments
  • Wiki pages and project settings
  • All collaborator associations

Reactive Content

Using action callbacks to reset signals — multi-button footer with live data preview

Document Editor

Edit your document details

Make changes to the document fields above and try to save.

Save changes?

You have unsaved changes. What would you like to do?

Your changes:

Title: My Document

Author: John Doe

Programmatic Open

Opening the dialog from JavaScript via the signal prop — no trigger click needed

Session Demo

Programmatic dialog open via signal prop

Session Expiring

Your session expires in 10 seconds.

Batch Operations

Reactive selection state with dynamic button labels and conditional content

Batch Operations

Confirm actions on multiple items

items selected

Delete Multiple Items

You are about to delete items. This action cannot be undone.

The following items will be deleted:

  • file1.txt
  • file2.pdf
  • file3.jpg
  • file4.doc

API Reference

Props

Prop Type Default Description
signal str | Signal auto-generated Named signal for programmatic open/close. Creates a DOM ref accessible as $name in Datastar expressions
cls str '' Additional CSS classes for the dialog element
Component Description
AlertDialog Root container that manages dialog open/close state
AlertDialogTrigger Button that opens the dialog. Props: variant ('default' | 'destructive'), size, and all Button props are passed through
AlertDialogContent Dialog content container rendered inside the native <dialog> element
AlertDialogHeader Flex column layout for title and description
AlertDialogTitle Dialog title — rendered as <h2> with aria-labelledby linkage
AlertDialogDescription Dialog description — rendered as <p> with aria-describedby linkage
AlertDialogFooter Footer layout — stacks vertically on mobile, horizontal on sm+
AlertDialogAction Confirm button. Props: action (Any) — signal setters or js() to run before close; variant ('default' | 'destructive')
AlertDialogCancel Cancel button — always renders with variant='outline'. Closes the dialog with no additional action