Skip to content

Alert Dialog ​

A modal dialog that interrupts the user with important content and expects a response. Becomes a bottom drawer on compact touch screens.

Usage ​

Approximate web preview — the HarmonyOS rendering is the reference.

API ​

Extracted from the @Param / @Event / @BuilderParam declarations in the library sources.

SAlertDialog ​

shadcn-vue AlertDialog: a modal dialog that interrupts the user and expects a response. Unlike Dialog it has no close button and ignores backdrop taps; the back gesture / Esc still cancel. Header, Title, Description and Footer are the Dialog parts (SDialogHeader … SDialogFooter).

Controlled (open: this.show!! or open + onOpenChange): Action / Cancel / back only request closing; the dialog closes when the parent's open flows back false (like SDialog), so the parent can refuse.

PropTypeDefaultDescription
open!!boolean | undefinedundefined
defaultOpenbooleanfalse
EventTypeDefaultDescription
onOpenChange(open: boolean) => void() => { }

Slots: children (trailing closure)

SAlertDialogTrigger ​

Slots: children (trailing closure)

SAlertDialogContent ​

Alert panel: no close button, backdrop taps ignored, Drawer on compact touch screens.

Slots: children (trailing closure)

SAlertDialogAction ​

Primary action; runs onAction, then closes the dialog (a controlled owner may refuse). Attach the work with onAction — a .onClick() chained on this component does not fire (the button's own click takes it).

PropTypeDefaultDescription
textResourceStr$r('app.string.spark_continue')
variantButtonVariant
ButtonVariant = 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link'
'default'e.g. 'destructive' for dangerous actions
disabledbooleanfalse
EventTypeDefaultDescription
onAction() => void() => { }

SAlertDialogCancel ​

Cancel button (outline); runs onCancel, then closes the dialog.

PropTypeDefaultDescription
textResourceStr$r('app.string.spark_cancel')
EventTypeDefaultDescription
onCancel() => void() => { }

MIT Licensed