Playground GitHub npm

Alert Dialog

Destructive-confirm modal — Cancel + Action, no backdrop dismiss.

ui overlay

Preview

Installation

npx slintcn@latest add alert-dialog

Usage

import { AlertDialog } from "slintcn/components/alert-dialog.slint";

AlertDialog {
    width: parent.width;
    height: parent.height;
    open <=> alert-open;
    title: "Delete this account?";
    description: "This action cannot be undone.";
    confirmed => { /* … */ }
}

Properties

open in-out bool

Two-way; consumer sets true to show, slintcn sets false on close.

title in string

Heading at the top of the modal.

description in string

Body text describing the consequences of the action.

action-label in string

Label for the destructive button (right side).

cancel-label in string

Label for the safe button (left side).

action-variant in ButtonVariant

Style for the action button — defaults to `destructive`.

confirmed callback ()

Fired when the action button is pressed; the modal closes itself.

cancelled callback ()

Fired on Cancel; the modal closes itself.

API

Accessibility
focusableyes
keyboardTabEscape
focus trapyes
Escapedismisses

Dependencies

popup-helpersbuttonalert-dialog-panel

Installed automatically as transitive dependencies of slintcn add alert-dialog.