Skip to content

useImperativeAlertDialog

@astryxdesign/core v0.7.1 · useImperativeAlertDialog

Returns ​

NameTypeDescription
show(options: ImperativeAlertDialogOptions) => voidShow the alert dialog with the given options. Options are the same as AlertDialog props minus isOpen, plus onAction.
hide() => voidHide the alert dialog.
isOpenRef<boolean>Whether the dialog is currently open.
HostComponentThe dialog element. Render it once in your template: <component :is="alert.Host" />.

Options ​

NameTypeDefaultDescription
titlestring—The question being asked. It names the dialog through aria-labelledby. Required.
descriptionstring—What happens if the user confirms. It is linked through aria-describedby. Required.
actionLabelstring—Label for the confirming action. Say what will happen, such as 'Delete project'. Required.
onAction(event: MouseEvent) => void—Called when the confirming action is activated. The dialog is not closed for you: call hide() once the work settles.
cancelLabelstring'Cancel'Label for the cancel button.
actionVariantAlertDialogActionVariant'destructive'Visual style of the confirming action.
isActionLoadingbooleanfalseShows a spinner on the confirming action while its work is in flight.
widthnumber | string400Preferred width. Numbers are pixels, strings are used as-is.